I am using an oauth2 scheme to handle authentication in nuxtJs.
Everything is working fine until the accessToken expires.
It seems that either the refreshTokens function does nothing nor the token is refreshed automatically by auth.
I set the validity duration of my acces tokens to 60 seconds on purpose for the tests.
Here is my config :
strategies: {
my_strategy: {
scheme: 'oauth2',
endpoints: {
authorization: 'https://api.local/oauth2/auth',
refresh: { url: 'https://api.local/oauth2/refresh', method: 'post' }, // seems to not being used
token: undefined,
userInfo: 'https://api.local/api/me/profile',
logout: 'https://api.local/oauth2/logout',
},
token: {
property: 'access_token',
type: 'Bearer',
maxAge: 60 // 60 seconds on purpose
},
refreshToken: {
property: 'refresh_token',
maxAge: 60 * 60
},
responseType: 'code',
codeChallengeMethod: 'S256',
grantType: 'authorization_code',
accessType: undefined,
redirectUri: process.env.OAUTH2_REDIRECT_URI,
logoutRedirectUri: undefined,
clientId: process.env.API_KEY,
scope: [],
}
}
When I call refreshTokens programmatically :
refresh() {
this.$auth.refreshTokens(); // nothing happens here
}
Am I supposed to extend axios by myself and implements the refresh token flow ? If so, what is the point to configure refresh token in the scheme ?