Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

254
Views
NuxtJs : refresh Oauth2 Token when it is expired

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 ?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!