mirror of
https://github.com/KuekHaoYang/KVideo.git
synced 2026-08-15 00:33:44 +08:00
fix: Change OAuth token request body to x-www-form-urlencoded format.
This commit is contained in:
@@ -25,14 +25,16 @@ export async function GET(request: NextRequest) {
|
||||
console.log('[OAuth Callback] Exchanging code for token...');
|
||||
const tokenResponse = await fetch('https://connect.linux.do/oauth2/token', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
},
|
||||
body: new URLSearchParams({
|
||||
client_id: CLIENT_ID,
|
||||
client_secret: CLIENT_SECRET,
|
||||
code,
|
||||
redirect_uri: REDIRECT_URI,
|
||||
grant_type: 'authorization_code',
|
||||
}),
|
||||
}).toString(),
|
||||
});
|
||||
|
||||
const tokenData = await tokenResponse.json();
|
||||
|
||||
Reference in New Issue
Block a user