try to edit url params

This commit is contained in:
Dobromir Popov
2024-04-17 02:13:47 +03:00
parent 08f6af1a7a
commit 5b80366ffc

View File

@ -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;
}