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

Roblox provider token revoke error #197

Open
S3mirScripts opened this issue Nov 8, 2024 · 3 comments
Open

Roblox provider token revoke error #197

S3mirScripts opened this issue Nov 8, 2024 · 3 comments

Comments

@S3mirScripts
Copy link

I run into this error every time I try to revoke the token: Error: Failed to parse response body

When reading the Roblox.ts provider file, I have found out it uses a function from Requests.ts where it tries to get the json body of the response.

Problem is, however, that Roblox does not return any body data as a response - see documentation.

Could this be handled somehow?

@pilcrowonpaper
Copy link
Owner

Can you try manually sending the revocation request and sharing the response body? The current code should work if the provider returns no response body or if it returns an empty json object.

@cortopy
Copy link

cortopy commented Nov 9, 2024

I was experiencing the same error with a custom provider. If it's the same issue, this can be fixed with #199

@S3mirScripts
Copy link
Author

I was experiencing the same error with a custom provider. If it's the same issue, this can be fixed with #199

Yes, I use bun as well.

Can you try manually sending the revocation request and sharing the response body? The current code should work if the provider returns no response body or if it returns an empty json object.

Took me a while but here you go:

Code:

const base64Credentials = Buffer.from(`${ROBLOX_CLIENT_ID}:${ROBLOX_CLIENT_SECRET}`).toString('base64');
const response = await fetch("https://apis.roblox.com/oauth/v1/token/revoke", {
    method: "POST",
    body: new URLSearchParams({
        token: session.refreshToken,
    }),
    headers: {
        "Authorization": `Basic ${base64Credentials}`,
        "Content-Type": "application/x-www-form-urlencoded"
    },
}); console.log(response, "\nBody:", await response.text())

Response:

Response {
  status: 200,
  statusText: 'OK',
  headers: Headers {
    date: 'Sat, 09 Nov 2024 17:53:58 GMT',
    server: 'public-gateway',
    'content-length': '0',
    'x-envoy-upstream-service-time': '35',
    vary: 'Origin',
    'strict-transport-security': 'max-age=3600',
    'x-ratelimit-limit': '10000, 10000;w=60',
    'x-ratelimit-remaining': '9998',
    'x-ratelimit-reset': '2',
    'x-roblox-region': 'us-central_rbx',
    'x-roblox-edge': 'fra4',
    'report-to': '{"group":"network-errors","max_age":604800,"endpoints":[{"url":"https://ncs.roblox.com/upload"}]}',
    nel: '{"report_to":"network-errors","max_age":604800,"success_fraction":0.001,"failure_fraction":1}'
  },
  body: ReadableStream { locked: true, state: 'closed', supportsBYOB: true },
  bodyUsed: true,
  ok: true,
  redirected: false,
  type: 'basic',
  url: 'https://apis.roblox.com/oauth/v1/token/revoke'
}
Body:

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

No branches or pull requests

3 participants