Hello,
I want to use nuxt auth with local refresh strategy. I have backend on ASP.NET Core. I’m stuck with refreshing token, API method for refresh not called. This is my configurtion (10 second age is for testing):
auth: {
redirect: {
login: '/login',
logout: '/login',
callback: '/login',
home: '/administration',
},
strategies: {
local: {
scheme: 'refresh',
token: {
property: 'token',
maxAge: 10, // seconds
global: true,
},
refreshToken: {
property: 'refresh_token',
data: 'refresh_token',
maxAge: 604800, // seconds, 1 week
},
user: { property: 'Username', autoFetch: true },
endpoints: {
login: { url: '/authenticate/login', method: 'post' },
logout: { url: '/authenticate/logout', method: 'post' },
user: {
url: '/authenticate/current',
method: 'get',
propertyName: false,
},
refresh: { url: '/authenticate/refresh-token/', method: 'post' },
},
},
},
},
When I’m calling authenticate/current API method and token is expired, API return Token-Expired: true in header and vue redirect me to login page as I said in configuration. But, I want to automatically refresh token, how can I do that?
Thanks for advice.
David