File tree 1 file changed +4
-1
lines changed 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -105,6 +105,7 @@ export class Skolengo {
105
105
this . config = {
106
106
httpClient : config ?. httpClient ?? axios . create ( { baseURL : BASE_URL } ) ,
107
107
onTokenRefresh : config ?. onTokenRefresh ?? ( ( ) => { } ) ,
108
+ refreshToken : config ?. refreshToken ,
108
109
handlePronoteError : config ?. handlePronoteError ?? false
109
110
}
110
111
}
@@ -1056,7 +1057,9 @@ export class Skolengo {
1056
1057
*/
1057
1058
public getTokenClaims ( ) : IdTokenClaims {
1058
1059
if ( this . tokenSet . id_token === undefined ) throw new TypeError ( 'id_token not present in TokenSet' )
1059
- return JSON . parse ( atob ( ( this . tokenSet . id_token ) . split ( '.' ) [ 1 ] ) )
1060
+ const dataPart = this . tokenSet . id_token . split ( '.' ) ?. at ( 1 ) ?. replace ( / - / g, '+' ) . replace ( / _ / g, '/' )
1061
+ if ( dataPart === undefined || dataPart . trim ( ) . length === 0 ) throw new TypeError ( 'Invalid id_token' )
1062
+ return JSON . parse ( atob ( dataPart ) )
1060
1063
}
1061
1064
1062
1065
/**
You can’t perform that action at this time.
0 commit comments