blo*_*low 6 bearer-token amazon-elastic-beanstalk identityserver4 jwt-auth asp.net-core-3.1
我正在尝试在生产(AWS Elasticbeanstalk 服务器)上部署一个使用 IdentityServer 的简单 asp 网络核心项目;我的测试项目基本上是启用了身份验证的 Visual Studio 2019 的 React.js 模板。
在开发中一切正常,但在生产中,当尝试使用 jwt 令牌对我的 api 进行身份验证时出现错误。
WWW-Authenticate: Bearer error="invalid_token", error_description="The issuer 'http://***.elasticbeanstalk.com' is invalid"
Run Code Online (Sandbox Code Playgroud)
使用的 access_token 是调用返回的内容
POST http://***.elasticbeanstalk.com/connect/token
Run Code Online (Sandbox Code Playgroud)
奇怪的行为是以下请求
GET http://***.elasticbeanstalk.com/connect/userinfo
Run Code Online (Sandbox Code Playgroud)
它正确返回了用户数据,这里使用了access_token,所以我认为令牌是正确的。
不幸的是,对我的 api 的请求因上述错误而失败。
我的Startup.cs代码是这样的:
WWW-Authenticate: Bearer error="invalid_token", error_description="The issuer 'http://***.elasticbeanstalk.com' is invalid"
Run Code Online (Sandbox Code Playgroud)
该appsetting.json文件包含此:
POST http://***.elasticbeanstalk.com/connect/token
Run Code Online (Sandbox Code Playgroud)
小智 8
在您的启动中设置您的域地址
services.AddIdentityServer(options =>
{
options.IssuerUri = "http://***.elasticbeanstalk.com";
})
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2361 次 |
| 最近记录: |