diff --git a/pages/api/auth/apple-signin.ts b/pages/api/auth/apple-signin.ts index 62c2dc5..7fd9bf1 100644 --- a/pages/api/auth/apple-signin.ts +++ b/pages/api/auth/apple-signin.ts @@ -14,7 +14,8 @@ export default async function handler(req, res) { const redirectUri = `https://sofia.mwitnessing.com/api/auth/callback/apple`; // 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 { 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 } }); + console.log("generated new token:" + token); return token; }