我的nuxt-auth令牌配置正确,但令牌从未存储

时间:2020-06-06 15:35:50

标签: authentication nuxt.js

这是我的身份验证配置

  auth: {
    strategies: {
      local: {
        endpoints: {
          login: {
            url: "/api/auth/login",
            method: "post",
            propertyName: "token"
          },
          logout: { url: "/api/auth/Logout", method: "post" },
          user: {
            url: "/api/user/detail",
            method: "get",
            propertyName: "user"
          }
        },
        tokenRequired: true,
        tokenName: "Authorization",
        globalToken: true,
        tokenType: "bearer",
        autoFetchUser: true
      }
    }
  },

我检查了一百次。

我确实有一个令牌对象返回。

{token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6I…M2Nn0.Fu5ugLtucxa6cDlD04D5ffQYs4dIKvcqtngJ5J3b5js"}

和某些原因,我的第二个请求不起作用。我检查了原因,因为标题没有令牌,我检查了听到的声音:

Authorization":"bearer undefined

这就是为什么我的第二个请求不起作用,没有令牌的原因。

0 个答案:

没有答案