try new generated appleID secret

This commit is contained in:
Dobromir Popov
2024-04-17 00:57:34 +03:00
parent 6a04513359
commit d81b64b34d
6 changed files with 60 additions and 44 deletions

View File

@ -9,17 +9,19 @@ export default async function handler(req, res) {
if (req.method === 'GET') {
try {
const appleKey = fs.readFileSync(path.resolve('./_deploy/appleKey.p8'), 'utf8');
const teamID = process.env.APPLE_TEAM_ID || "XC57P9SXDK";
const keyID = process.env.APPLE_KEY_ID || "TB3V355G5Y";
const appleAppID = process.env.APPLE_APP_ID || "com.mwitnessing.mwitnessing";
const token = jwt.sign({}, appleKey, {
algorithm: 'ES256',
expiresIn: '180d',
issuer: process.env.APPLE_TEAM_ID,
issuer: teamID,
header: {
alg: 'ES256',
kid: process.env.APPLE_KEY_ID,
kid: keyID,
},
audience: 'https://appleid.apple.com',
subject: process.env.APPLE_ID,
subject: appleAppID,
});
// Redirect to Apple's authentication page, or send the token to the client to do so