"dependencies": {
"@nuxtjs/auth-next": "^5.0.0-1610809099.bcf293f",
"@nuxtjs/axios": "^5.12.5",
}
I'm using local auth strategy with Bearer token.
auth: {
redirect: {
login: '/login',
logout: '/login',
callback: '/login',
home: '/',
},
strategies: {
local: {
token: {
property: 'accessToken',
required: true,
// type: 'Bearer',
},
user: {
property: false,
// autoFetch: true,
},
endpoints: {
login: { url: '/login', method: 'post' },
logout: { url: '/users/logout', method: 'post' },
user: { url: '/users', method: 'get' },
},
},
},
},
After a successful login, I'm redirected to / as expected and defined in home, but suppose that I'm in a route like /keys and my token expired, which means that I'll be redirected to /login as expected, but I expect that after another successful login, this time I'll be redirected to /keys.
I was doing this (@nuxtjs/auth v4) by myself using a plugin like this one, which looks pretty much the same as here in this core function.
So I'm wondering if I can do that without this plugin using just the new (@nuxtjs/auth-next v5)?
I removed the plugin, set many properties (rewriteRedirects, fullPath), but I couldn't find a way to it to work.
Ok, as usual after 1 hour I figured out that the only thing I need to do was to comment/remove home: '/' in redirect.
home: User will be redirected to this path after login. (rewriteRedirects will rewrite this path)
It was not clear to me that if I had home set in configuration it will disable the rewriteRedirects to work properly. As English is not my first language, maybe it was my fault to understand, or maybe the documentation is not clear enough about that, and so we need to improve it.
Most helpful comment
Ok, as usual after 1 hour I figured out that the only thing I need to do was to comment/remove
home: '/'in redirect.It was not clear to me that if I had
homeset in configuration it will disable therewriteRedirectsto work properly. As English is not my first language, maybe it was my fault to understand, or maybe the documentation is not clear enough about that, and so we need to improve it.