Skip to content

Commit 6e88de3

Browse files
committed
Now forcing a logout if the profile request fails even though an auth0 token is present.
1 parent 4f4edcc commit 6e88de3

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

functions/common/methods.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,10 @@ export const getPayloadAuthorization = async (
499499
const { payload } = await jose.jwtVerify(authStr, JWKS)
500500
return payload
501501
} catch (e: any) {
502-
if (e.code === 'ERR_JWT_EXPIRED') return null
502+
if (e.code === 'ERR_JWT_EXPIRED') {
503+
log('Auth0 JWT expired', e, 'warn')
504+
return null
505+
}
503506
log('Auth0 JWT verification error', e, 'warn')
504507
return authStr
505508
}

src/store/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,10 @@ export const useBikeTagStore = defineStore(BikeTagDefaults.store, {
172172
},
173173
})
174174
.catch((e) => {
175+
/// THIS IS COSTLY
176+
this.auth0Token = undefined
177+
localStorage.clear()
178+
this.SET_PROFILE()
175179
console.error('error fetching profile', e)
176180
return e
177181
})
@@ -745,7 +749,7 @@ export const useBikeTagStore = defineStore(BikeTagDefaults.store, {
745749
// ======= mutations ================================================
746750
// ==================================================================
747751

748-
SET_PROFILE(profile: any) {
752+
SET_PROFILE(profile?: any) {
749753
const oldState = this.profile
750754

751755
if (

0 commit comments

Comments
 (0)