File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ const getApplePublicKey = async () => {
29
29
return currentKey ;
30
30
} ;
31
31
32
- const verifyIdToken = async ( token , clientID ) => {
32
+ const verifyIdToken = async ( { token, id } , clientID ) => {
33
33
if ( ! token ) {
34
34
throw new Parse . Error (
35
35
Parse . Error . OBJECT_NOT_FOUND ,
@@ -45,6 +45,12 @@ const verifyIdToken = async (token, clientID) => {
45
45
`id token not issued by correct OpenID provider - expected: ${ TOKEN_ISSUER } | from: ${ jwtClaims . iss } `
46
46
) ;
47
47
}
48
+ if ( jwtClaims . sub !== id ) {
49
+ throw new Parse . Error (
50
+ Parse . Error . OBJECT_NOT_FOUND ,
51
+ `auth data is invalid for this user.`
52
+ ) ;
53
+ }
48
54
if ( clientID !== undefined && jwtClaims . aud !== clientID ) {
49
55
throw new Parse . Error (
50
56
Parse . Error . OBJECT_NOT_FOUND ,
@@ -56,7 +62,7 @@ const verifyIdToken = async (token, clientID) => {
56
62
57
63
// Returns a promise that fulfills if this id token is valid
58
64
function validateAuthData ( authData , options = { } ) {
59
- return verifyIdToken ( authData . id , options . client_id ) ;
65
+ return verifyIdToken ( authData , options . client_id ) ;
60
66
}
61
67
62
68
// Returns a promise that fulfills if this app id is valid.
You can’t perform that action at this time.
0 commit comments