mirror of
https://github.com/HabitRPG/habitica.git
synced 2026-03-13 08:41:14 +08:00
always verify token
This commit is contained in:
@@ -41,10 +41,11 @@ async function _appleProfile (req) {
|
||||
const passedToken = req.body.id_token ? req.body.id_token : req.query.id_token;
|
||||
if (code) {
|
||||
const response = await auth.accessToken(code);
|
||||
idToken = jwt.decode(response.id_token);
|
||||
} else if (passedToken) {
|
||||
idToken = await jwt.verify(passedToken, applePublicKey, { algorithms: ['RS256'] });
|
||||
passedToken = response.id_token
|
||||
idToken = jwt.verify(response.id_token, applePublicKey, { algorithms: ['RS256'] });
|
||||
}
|
||||
idToken = await jwt.verify(passedToken, applePublicKey, { algorithms: ['RS256'] });
|
||||
|
||||
return {
|
||||
id: idToken.sub,
|
||||
emails: [idToken.email],
|
||||
|
||||
Reference in New Issue
Block a user