我有以下设置:
前端:AngularJS应用程序
后端:WebApi与Identity Server一起验证客户端
在我的后端中,我这样创建一个新的内存客户端:
new Client
{
Enabled = true,
ClientId = "myapp.mycompany",
ClientUri = "https://myapp.mycompany.com",
ClientName = "My Client",
Flow = Flows.Implicit,
AllowAccessToAllScopes = true,
IdentityTokenLifetime = 300,
AccessTokenLifetime = 3600,
RequireConsent = false,
RedirectUris = new List<string>
{
"https://myapp.mycompany.com/assets/idSrv/callback.html",
"https://myapp.mycompany.com/assets/idSrv/silentrefreshframe.html"
},
PostLogoutRedirectUris = new List<string>
{
"https://myapp.mycompany.com/index.html"
}
},
在我的前端代码中,我有以下声明客户端的代码,我使用oidc-token-manager.js客户端
var authority = 'https://sts.mycompany.com/identity';
return {
baseUri: protocol,
tokenConfig: {
'client_id': 'myapp.mycompany',
'authority': authority,
'redirect_uri': 'https://myapp.mycompany.com/assets/idSrv/callback.html',
'post_logout_redirect_uri': 'https://myapp.mycompany.com/index.html',
'response_type': 'id_token token',
'scope': 'openid profile roleScope webApiScope',
'silent_redirect_uri': 'https://myapp.mycompany.com/assets/idSrv/silentrefreshframe.html',
'silent_renew': true
},
isDebugging: isDebugging
};
当我尝试访问我的网站时:
我遇到了以下错误:
客户端应用程序未知或未经授权。
我已启用日志记录,以下是我的日志记录:
"Unknown client or not enabled: myapp.mycompany"
"{
\"RedirectUri\": \"https://myapp.mycompany.com/assets/idSrv/callback.html\",
\"SubjectId\": \"unknown\",
\"Flow\": \"AuthorizationCode\",
\"RequestedScopes\": \"\",
\"Raw\": {
\"state\": \"18141519257414835\",
\"nonce\": \"8585758378803323\",
\"client_id\": \"myapp.mycompany\",
\"redirect_uri\": \"https://myapp.mycompany.com/assets/idSrv/callback.html\",
\"response_type\": \"id_token token\",
\"scope\": \"openid profile roleScope webApiScope\"
}
}"
End authorize request
3001: "Endpoint failure" / "Endpoints" (Failure), Context: EventContext { ..., Details: EndpointDetail { EndpointName: "authorize" }