fix: use x-www-form-urlencoded for token exchange requests
This commit is contained in:
@@ -250,19 +250,23 @@ const handleOAuthRedirect = async () => {
|
|||||||
return E.left("NO_CODE_VERIFIER" as const)
|
return E.left("NO_CODE_VERIFIER" as const)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const data = new URLSearchParams({
|
||||||
|
grant_type: "authorization_code",
|
||||||
|
code: queryParams.code,
|
||||||
|
client_id: clientID,
|
||||||
|
client_secret: clientSecret,
|
||||||
|
redirect_uri: redirectUri,
|
||||||
|
code_verifier: codeVerifier,
|
||||||
|
})
|
||||||
|
|
||||||
// Exchange the authorization code for an access token
|
// Exchange the authorization code for an access token
|
||||||
const tokenResponse = await runRequestThroughInterceptor({
|
const tokenResponse = await runRequestThroughInterceptor({
|
||||||
url: tokenEndpoint,
|
url: tokenEndpoint,
|
||||||
data: JSON.stringify({
|
data: data.toString(),
|
||||||
grant_type: "authorization_code",
|
|
||||||
code: queryParams.code,
|
|
||||||
client_id: clientID,
|
|
||||||
client_secret: clientSecret,
|
|
||||||
redirect_uri: redirectUri,
|
|
||||||
code_verifier: codeVerifier,
|
|
||||||
}),
|
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {},
|
headers: {
|
||||||
|
"Content-Type": "application/x-www-form-urlencoded",
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
// Clean these up since we don't need them anymore
|
// Clean these up since we don't need them anymore
|
||||||
|
|||||||
Reference in New Issue
Block a user