Car*_*mas 5 authentication validation oauth-2.0 jwt identityserver3
我设置了IdentityServer3实例,并且我使用授权端点(/ core/connect/authorize)请求令牌.
我的请求令牌的应用程序是iOS应用程序.
我传递了以下参数;
client_id=<clientid>
response_type=id_token
scope=openid
redirect_uri=<redirecturi>
state=<state>
nonce=<nonce>
Run Code Online (Sandbox Code Playgroud)
这就开辟了一个网页视图对我来说,我输入我的凭据,并返回redirect_uri与#id_token附加到URL.
要验证令牌,我将其传递给IdentityServer的访问令牌验证端点(/ core/connect/accesstokenvalidation).我追加了?token=<access token received from login>.
然后我得到了答复
{ "Message": "invalid_token" }
Run Code Online (Sandbox Code Playgroud)
当我检查日志
System.IdentityModel.Tokens.SecurityTokenInvalidAudienceException: IDX10214: Audience validation failed. Audience: '<clientid>'. Did not match: validationParamters.ValidAudience: '<identity_server_host>/resources' or validationParameters.ValidAudiences: 'null'
Run Code Online (Sandbox Code Playgroud)
我在这做错了什么?当然,创建令牌的IdentityServer应该将其验证为有效吗?
在您的示例中,您没有请求访问令牌。和
response_type=id_token
Run Code Online (Sandbox Code Playgroud)
您仅获得可针对身份令牌端点进行验证的身份令牌。要通过您的请求获取访问令牌,您必须将请求更改为
response_type=id_token token
Run Code Online (Sandbox Code Playgroud)