Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate setCookie from /mobileapi/userinfo to /v1/users/authenticated; add getUserFunds method #824

Merged
merged 3 commits into from
Aug 16, 2024

Conversation

alanbixby
Copy link
Member

BREAKING CHANGE: getCurrentUser() calls https://www.roblox.com/mobileapi/userinfo which is being deprecated August 27, 2024. This method is used by setCookie to validate the cookie - following this change, getAuthenticatedUser() will be used instead which has a different return schema.

See https://devforum.roblox.com/t/official-list-of-deprecated-web-endpoints/62889/66


BEFORE:

{
  "UserID": 5903228,
  "UserName": "BixbyAlan",
  "RobuxBalance": 27500,
  "ThumbnailUrl": "https://tr.rbxcdn.com/30DAY-Avatar-8CEE2325D44533A87DDA3AD9960E0BCD-Png/352/352/Avatar/Png/noFilter",
  "IsAnyBuildersClubMember": false,
  "IsPremium": false
}

AFTER:

{
   "id": 5903228,
   "name": "BixbyAlan",
   "displayName": "BixbyAlan"
}

getCurrentUser() has been deprecated and polyfilled for backwards compatibility - it will now make 4 API calls to build the same response as before. getUserFunds has been added as a new method to facilitate this functionality.

Deprecation messages are added as console output and in the method return value to indicate the change - users can opt out of the console printing with noblox.setOptions({ show_deprecation_warnings: false })

import 'dotenv/config';
import noblox from "noblox.js";

(async () => {
  const auth = await noblox.setCookie(process.env.ROBLOX_COOKIE);
  console.log(auth)
  // noblox.setOptions({ show_deprecation_warnings: false })
  console.log(await noblox.getCurrentUser());
  console.log(await noblox.getCurrentUser("RobuxBalance"));
  console.log(await noblox.getUserFunds(auth.id));
})();

Deprecation message opted in:
image

Deprecation message opted out:
image

…entUser() to getAuthenticatedUser(); polyfill and deprecate getCurrentUser() + add console warnings for getCurrentUser usage

BREAKING CHANGE: getCurrentUser's /mobileinfo api endpoint is being deprecated by Roblox on August 27th (https://devforum.roblox.com/t/official-list-of-deprecated-web-endpoints/62889/66), setCookie will now have a new response type
@alanbixby alanbixby marked this pull request as ready for review August 14, 2024 19:30
@Neztore Neztore merged commit 2be4343 into noblox:master Aug 16, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants