如何在auth nuxt js中添加过期的令牌?

时间:2020-07-04 10:38:31

标签: javascript vue.js authentication nuxt.js

我在nuxt.config.js中尝试这样:

auth: {
    redirect: {
      login: '/',
      home: '/home',
      logout: '/'
    },
    strategies: {
      local: {
        scheme: "refresh",
        token: {
          property: 'access_token',
          maxAge: 900,
          // type: 'Bearer'
        },
        refreshToken: {
          property: "refresh_token",
          data: "refresh_token",
          maxAge: 60 * 15
        },
        endpoints: {
          login: {
            url: '/auth/token',
            method: 'post',
            propertyName: 'response.token'
          },
          user: false,
          logout: false
        },
        tokenRequired: true,
        tokenType: 'Bearer '
      }
    },
    token: {
      name: 'token'
    },
    cookie: {
      name: 'token'
    }
},

我设置了15分钟,但是15分钟后,我仍然自动登录 我该如何解决这个问题?

参考:https://dev.auth.nuxtjs.org/schemes/refresh.html#options

0 个答案:

没有答案