Enhance JWT Token Management and Authentication Flow (#720)
- Implement extended token lifetime for "Remember Me" functionality - Add token expiration details to authentication responses - Update client-side token handling to support dynamic expiration - Modify authentication middleware to handle token initialization more robustly - Configure JWT configuration to support longer token lifetimes
This commit is contained in:
8
client/middleware/01.check-auth.global.js
vendored
8
client/middleware/01.check-auth.global.js
vendored
@@ -2,7 +2,13 @@ import { fetchAllWorkspaces } from "~/stores/workspaces.js"
|
||||
|
||||
export default defineNuxtRouteMiddleware(async () => {
|
||||
const authStore = useAuthStore()
|
||||
authStore.initStore(useCookie("token").value, useCookie("admin_token").value)
|
||||
|
||||
// Get tokens from cookies
|
||||
const tokenValue = useCookie("token").value
|
||||
const adminTokenValue = useCookie("admin_token").value
|
||||
|
||||
// Initialize the store with the tokens
|
||||
authStore.initStore(tokenValue, adminTokenValue)
|
||||
|
||||
if (authStore.token && !authStore.user) {
|
||||
const workspaceStore = useWorkspacesStore()
|
||||
|
||||
Reference in New Issue
Block a user