我已经为我的Angular应用程序配置了隐式流设置 .

const settings: any = {
authority: 'https://localhost:44381',
client_id: 'AngularCore',
redirect_uri: 'https://localhost:44301/authcallback',
post_logout_redirect_uri: 'https://localhost:44301/',
response_type: 'id_token token',
scope: 'openid profile mywebapicore.read mywebapicore.write',
accessTokenExpiringNotificationTime: 10,
filterProtocolClaims: true,
loadUserInfo: true,
automaticSilentRenew: true,
silent_redirect_uri: 'https://localhost:44301/silentrenew'
}

这是我的IdentityServer4 ApiResource

new ApiResource {
Name = "mywebapicore"
,ApiSecrets = new List<Secret>() { new Secret("apisecret".Sha256()) }

,Scopes = {
new Scope(){Name = "mywebapicore.read",DisplayName = "Read only 
access to the mywebapicore"},

new Scope(){Name = "mywebapicore.write", DisplayName = "Write only access to 
the mywebapicore"}}}

这是我使用IdentityServer3.AccessTokenValidation的ASP.NET WEB API配置

var options = new IdentityServerBearerTokenAuthenticationOptions
        {
            Authority = "https://localhost:44381",
            RequiredScopes = new[] { "mywebapicore.read", "mywebapicore.write" },
            ClientId = "mywebapicore",
            ClientSecret = System.Uri.EscapeDataString("apisecret"),
            PreserveAccessToken = true
};
app.UseIdentityServerBearerTokenAuthentication(options);

问题 - 我使用访问令牌从我的Angular App调用ASP.NET WEB API,我收到此错误 - Bearer error="insufficient_scope"

如果我只包含一个Scope然后它正在按预期工作但是如果我包含多个范围然后它将错误消息抛出403错误 Bearer error="insufficient_scope"

请帮助...在此先感谢!!!!