Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

257
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda