【发布时间】:2021-02-11 00:46:52
【问题描述】:
我正在尝试通过 IdentityServe 授权一个反应项目。
Sorry, there was an error : invalid_request
Missing openid scope
Request Id: 0HM6DDV35HLDE:00000001
告诉我可能是什么原因?看来网址是正确的。最有可能的原因在于配置参数。
配置:
public static IEnumerable<Client> Clients =>new List<Client>
{
new Client
{
ClientId = "js_oidc",
ClientName = "Javascript Client",
AllowedGrantTypes = GrantTypes.Implicit,
AllowAccessTokensViaBrowser = true,
AbsoluteRefreshTokenLifetime = 200,
IdentityTokenLifetime = 15,
AccessTokenLifetime = 100,
AuthorizationCodeLifetime = 15,
SlidingRefreshTokenLifetime = 120,
RedirectUris =
{
"http://localhost:3000/callback.html",
"http://localhost:3000/silent.html"
},
PostLogoutRedirectUris = { "http://localhost:3000/index.html" },
AllowedCorsOrigins = { "http://localhost:3000" },
AllowedScopes =
{
IdentityServerConstants.StandardScopes.OpenId,
IdentityServerConstants.StandardScopes.Profile,
IdentityServerConstants.StandardScopes.Email,
"api1"
}
}
};
授权服务:
constructor() {
const settings = {
authority: "http://localhost:5001/",
client_id: "js_oidc",
redirect_uri: "http://localhost:3000/callback.html",
silent_redirect_uri: "http://localhost:3000/silent.html",
post_logout_redirect_uri: "http://localhost:3000/index.html",
scope: "api1"
};
this.userManager = new UserManager(settings);
}
【问题讨论】: