@@ -1104,7 +1104,7 @@ describe('apple signin auth adapter', () => {
1104
1104
it ( 'should not verify invalid id_token' , async ( ) => {
1105
1105
try {
1106
1106
await apple . validateAuthData (
1107
- { id : 'the_token' } ,
1107
+ { id : 'the_user_id' , token : ' the_token' } ,
1108
1108
{ client_id : 'secret' }
1109
1109
) ;
1110
1110
fail ( ) ;
@@ -1118,11 +1118,12 @@ describe('apple signin auth adapter', () => {
1118
1118
iss : 'https://appleid.apple.com' ,
1119
1119
aud : 'secret' ,
1120
1120
exp : Date . now ( ) ,
1121
+ sub : 'the_user_id' ,
1121
1122
} ;
1122
1123
spyOn ( jwt , 'verify' ) . and . callFake ( ( ) => fakeClaim ) ;
1123
1124
1124
1125
const result = await apple . validateAuthData (
1125
- { id : 'the_token' } ,
1126
+ { id : 'the_user_id' , token : ' the_token' } ,
1126
1127
{ client_id : 'secret' }
1127
1128
) ;
1128
1129
expect ( result ) . toEqual ( fakeClaim ) ;
@@ -1131,12 +1132,13 @@ describe('apple signin auth adapter', () => {
1131
1132
it ( 'should throw error with with invalid jwt issuer' , async ( ) => {
1132
1133
const fakeClaim = {
1133
1134
iss : 'https://not.apple.com' ,
1135
+ sub : 'the_user_id' ,
1134
1136
} ;
1135
1137
spyOn ( jwt , 'verify' ) . and . callFake ( ( ) => fakeClaim ) ;
1136
1138
1137
1139
try {
1138
1140
await apple . validateAuthData (
1139
- { id : 'the_token' } ,
1141
+ { id : 'the_user_id' , token : ' the_token' } ,
1140
1142
{ client_id : 'secret' }
1141
1143
) ;
1142
1144
fail ( ) ;
@@ -1151,12 +1153,13 @@ describe('apple signin auth adapter', () => {
1151
1153
const fakeClaim = {
1152
1154
iss : 'https://appleid.apple.com' ,
1153
1155
aud : 'invalid_client_id' ,
1156
+ sub : 'the_user_id' ,
1154
1157
} ;
1155
1158
spyOn ( jwt , 'verify' ) . and . callFake ( ( ) => fakeClaim ) ;
1156
1159
1157
1160
try {
1158
1161
await apple . validateAuthData (
1159
- { id : 'the_token' } ,
1162
+ { id : 'the_user_id' , token : ' the_token' } ,
1160
1163
{ client_id : 'secret' }
1161
1164
) ;
1162
1165
fail ( ) ;
0 commit comments