authentication - 我的 nuxt-auth 令牌配置正确,但令牌从未存储
问题描述
这是我的身份验证配置
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
这就是为什么我的第二个请求不起作用,没有令牌。
解决方案
推荐阅读
- node.js - 获取 Clients.findById 不是函数错误,不知道为什么
- elasticsearch - ElasticSearch:在文档中查找相互匹配
- python - Python Pandas 多条件赋值
- c# - 如何修复错误:“框架资源提取失败。引发了 'System.OutOfMemoryException' 类型的异常。”
- javascript - 数字到字符串表示
- vue.js - Nativescript iOS 应用程序无法连接到自签名本地域
- javascript - 物质JS空心圆体
- css - 将 div 左对齐到居中的容器
- babylonjs - 从 Babylon.js 中的屏幕坐标获取 wold 坐标
- javascript - 如果没有从日期选择器材料中选择日期,则禁用按钮