Skip to content

Commit 239fa2f

Browse files
author
dmlenton
committed
Apple email dervied from decoded token
1 parent 84e047e commit 239fa2f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

routes/api/account.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const { Audience } = require('../../models/audience');
1313
const { Program } = require('../../models/program');
1414
const { OAuth2Client } = require('google-auth-library');
1515
const appleSignin = require('apple-signin-auth');
16+
const jwt = require('jsonwebtoken');
1617

1718
const passports = new Passports();
1819
// const permissions = require('../../models/permissions');
@@ -359,10 +360,10 @@ module.exports = function (app) {
359360
// Additional verification not used
360361
// const authorizationCode = req.body.authorizationCode;
361362
// const nonce = req.body.nonce;
362-
// let email = req.body.email;
363363
const givenName = req.body.givenName;
364364
const familyName = req.body.familyName;
365-
const { sub: userAppleId, email } = await appleSignin.verifyIdToken(token, {
365+
const { email } = jwt.decode(token);
366+
const { sub: userAppleId } = await appleSignin.verifyIdToken(token, {
366367
// Optional Options for further verification - Full list can be found here https://github.com/auth0/node-jsonwebtoken#jwtverifytoken-secretorpublickey-options-callback
367368
// audience: 'localhost', // client id - can also be an array
368369
// nonce: 'NONCE', // nonce

0 commit comments

Comments
 (0)