'Can't get user presence correctly - Roblox API
I am developing a Chrome extension that sets your Discord Rich Presence status based on what you're doing on the Roblox website, and I want to detect if the user is playing a game. However, Roblox's Presence API doesn't seem to be working correctly.
When I give it a user ID on the API site, it returns the currently played game correctly, but when I run the cURL command it generates it does not return the universeId, gameId, rootPlaceId, placeId, or lastLocation.
Here's the response generated by the website:
{
"userPresences": [
{
"userPresenceType": 2,
"lastLocation": "[Leaderboards!] The Rake REMASTERED",
"placeId": 2413927524,
"rootPlaceId": 2413927524,
"gameId": "436735c2-7010-4dd0-83a1-0e3af1510779",
"universeId": 847722000,
"userId": 1843923756,
"lastOnline": "2022-02-28T14:56:06.823Z"
}
]
}
cURL command generated by the website:
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{ \
"userIds": [ \
1843923756 \
] \
}' 'https://presence.roblox.com/v1/presence/users'
and here's what the cURL command returns:
{
"userPresences": [{
"userPresenceType": 2,
"lastLocation": "",
"placeId": null,
"rootPlaceId": null,
"gameId": null,
"universeId": null,
"userId": 1843923756,
"lastOnline": "2022-02-28T14:56:06.823Z"
}]
}
The only solution I can think of is using Roblox's legacy presence API (https://api.roblox.com/Users/1843923756/OnlineStatus) but I can't access it on the Roblox website.
No 'Access-Control-Allow-Origin' header is present on the requested resource.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
