File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -42,8 +42,9 @@ export const authOptions: AuthOptions = {
4242 }
4343
4444 // Access token is expired :(
45- if ( Date . now ( ) / 1000 > parseJwt ( token . accessToken ) . exp ) {
46- const tokenId = parseJwt ( token . refreshToken ) . jti ;
45+ const accessTokenPayload = parseJwt ( token . accessToken ) ;
46+ if ( Date . now ( ) / 1000 > accessTokenPayload . exp ) {
47+ const tokenId = accessTokenPayload . jti ;
4748
4849 // Obtain new token pair and new profile data
4950 if ( ! refreshTokenPromiseCache [ tokenId ] ) {
@@ -52,7 +53,7 @@ export const authOptions: AuthOptions = {
5253 `${ process . env . NEXT_PUBLIC_API_URL } /auth/token/` ,
5354 {
5455 method : 'POST' ,
55- headers : { 'Content-Type' : 'application/json' , } ,
56+ headers : { 'Content-Type' : 'application/json' } ,
5657 body : JSON . stringify ( { refresh : token . refreshToken } ) ,
5758 } ,
5859 )
You can’t perform that action at this time.
0 commit comments