try to edit url params
This commit is contained in:
@ -14,7 +14,8 @@ export default async function handler(req, res) {
|
|||||||
const redirectUri = `https://sofia.mwitnessing.com/api/auth/callback/apple`;
|
const redirectUri = `https://sofia.mwitnessing.com/api/auth/callback/apple`;
|
||||||
|
|
||||||
// Redirect to Apple's authorization page
|
// Redirect to Apple's authorization page
|
||||||
res.redirect(`https://appleid.apple.com/auth/authorize?response_type=code&client_id=${process.env.APPLE_APP_ID}&redirect_uri=${encodeURIComponent(redirectUri)}&scope=name+email&response_mode=form_post&state=STATE&client_secret=${encodeURIComponent(clientSecret)}`);
|
const url = `https://appleid.apple.com/auth/authorize?response_type=code&client_id=${process.env.APPLE_APP_ID}&redirect_uri=${encodeURIComponent(redirectUri)}&scope=email&response_mode=form_post&state=initial&usePopup=true&client_secret=${encodeURIComponent(clientSecret)}`;
|
||||||
|
res.redirect(url);
|
||||||
} else {
|
} else {
|
||||||
res.status(405).json({ error: 'Method not allowed' });
|
res.status(405).json({ error: 'Method not allowed' });
|
||||||
}
|
}
|
||||||
@ -39,5 +40,6 @@ function generateClientSecret() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const token = jwt.sign(claims, appleKey, { algorithm: 'ES256', header: { alg: 'ES256', kid: keyID } });
|
const token = jwt.sign(claims, appleKey, { algorithm: 'ES256', header: { alg: 'ES256', kid: keyID } });
|
||||||
|
console.log("generated new token:" + token);
|
||||||
return token;
|
return token;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user