Open S3mirScripts opened 4 days ago
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.
I was experiencing the same error with a custom provider. If it's the same issue, this can be fixed with https://github.com/pilcrowonpaper/arctic/pull/199
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:
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?