sidebase / nuxt-auth

Authentication built for Nuxt 3! Easily add authentication via OAuth providers, credentials or Email Magic URLs!
https://auth.sidebase.io
MIT License
1.31k stars 164 forks source link

Is there an EXAMPLE of a refresh scheme? (Migrating from @nuxtjs/auth-next) #407

Closed akiot-b closed 1 year ago

akiot-b commented 1 year ago

Discussed in https://github.com/sidebase/nuxt-auth/discussions/401

Originally posted by **akiot-b** May 19, 2023 I was using @nuxtjs/auth-next with Nuxt2 but am thinking of migrating to sidebase/nuxt-auth with Nuxt3. I can't find an example that corresponds to the refresh scheme in @nuxtjs/auth-next. Where can I find it? In @nuxtjs/auth-next, the following definition was used. nuxt.config.js ```nuxt.config.js auth: { // https://dev.auth.nuxtjs.org/schemes/refresh.html#usage localStorage: false, cookie: { options: { secure: process.env.NODE_ENV === 'production', expires: 30, }, }, strategies: { localRefresh: { scheme: 'refresh', token: { property: 'detail.access_token', maxAge: 60 * 15, type: 'Bearer', }, refreshToken: { property: 'detail.refresh_token', data: 'refresh_token', maxAge: 60 * 60 * 24 * 30, }, user: { property: 'detail.user', }, autoLogout: true, endpoints: { login: { url: '/api/auth/signin', method: 'post', withCredentials: true, }, refresh: { url: '/api/auth/refresh', method: 'post', withCredentials: true, }, user: { url: '/api/auth/user', method: 'get', }, logout: { url: '/api/auth/signout', method: 'post', withCredentials: true, }, }, }, }, }, ```
zoey-kaiser commented 1 year ago

Currently there is no refresh schema provider in this package. There is a PR, that aims to add support for this here: https://github.com/sidebase/nuxt-auth/pull/373

Lets follow up the conversation and testing there, to keep it in one place!