Token exchange body needs to be JSON

This commit is contained in:
Justin Spahr-Summers 2025-01-24 13:44:26 +00:00
commit 874320ebe6
No known key found for this signature in database

View file

@ -66,9 +66,9 @@ export async function handleOAuthCallback(serverUrl: string, code: string): Prom
const response = await fetch(metadata.token_endpoint, { const response = await fetch(metadata.token_endpoint, {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/x-www-form-urlencoded', 'Content-Type': 'application/json',
}, },
body: new URLSearchParams({ body: JSON.stringify({
grant_type: 'authorization_code', grant_type: 'authorization_code',
code, code,
code_verifier: codeVerifier, code_verifier: codeVerifier,