-
-
Notifications
You must be signed in to change notification settings - Fork 189
Closed as duplicate of#621
Labels
bugA bug that needs to be resolvedA bug that needs to be resolvedpendingAn issue waiting for triageAn issue waiting for triage
Description
Environment
- Operating System: Darwin
- Node Version: v20.17.0
- Nuxt Version: 3.15.1
- CLI Version: 3.20.0
- Nitro Version: 2.10.4
- Package Manager: yarn@1.22.22
- Builder: -
- User Config: alias, app, srcDir, debug, dev, devServer, ssr, devtools, modules, auth, vite, compatibilityDate
- Runtime Modules: @sidebase/nuxt-auth@0.10.0
- Build Modules: -
Reproduction
I have this endpoints:
http://example.com/user/token -> response -> { access_token: "", refresh_token: "" }
http://example.com/user/token-refresh -> body -> { refresh_token: "" } -> response -> { access_token: "", refresh_token: "" }
http://example.com/user/my-user -> response -> { id: "", name: "" }
My configuration is this:
auth: {
isEnabled: true,
disableInternalRouting: true,
disableServerSideAuth: true,
baseURL: 'http://example.com',
provider: {
type: 'local',
pages: {
login: '/login',
},
endpoints: {
signIn: { path: '/user/token', method: 'post' },
signOut: false,
signUp: false,
getSession: { path: '/user/my-user', method: 'get' },
},
token: {
signInResponseTokenPointer: '/access_token',
},
refresh: {
isEnabled: true,
endpoint: { path: '/user/token-refresh', method: 'post' },
refreshOnlyToken: false,
token: {
signInResponseRefreshTokenPointer: '/refresh_token',
refreshResponseTokenPointer: '/access_token',
refreshRequestTokenPointer: '/refresh_token',
},
},
session: {
dataType: {
id: 'string',
name: 'string',
},
dataResponsePointer: '/',
},
},
sessionRefresh: {
enablePeriodically: false,
enableOnWindowFocus: true,
},
globalAppMiddleware: {
isEnabled: true,
addDefaultCallbackUrl: false,
},
},
My files .vue:
index.vue
<script setup lang="ts">
const { signOut, status, data } = useAuth()
const test = () => {
signOut({ callbackUrl: '/login' })
}
</script>
<template>
<div>
{{ status }}<br />
{{ data }}<br />
<button @click="test">logout</button>
</div>
</template>
login.vue
<script setup lang="ts">
const { signIn, status, data } = useAuth()
const username = ref('user')
const password = ref('password')
definePageMeta({
auth: {
unauthenticatedOnly: true,
navigateAuthenticatedTo: '/'
}
})
const submit = (): void => {
signIn({ name: username.value, password: password.value }, { callbackUrl: '/' })
}
</script>
<template>
<div>
{{ status }}<br />
{{ data }}<br />
<input v-model="username" type="text" />
<input v-model="password" type="password" />
<button @click="submit()">sign in</button>
</div>
</template>
Describe the bug
Hi, I have a problem when refresh page after login... After login I go to index.vue page but if I refresh page... I go always in login.vue... why?
Thanks a lot
Additional context
No response
Logs
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugA bug that needs to be resolvedA bug that needs to be resolvedpendingAn issue waiting for triageAn issue waiting for triage