fix invalid_scope error invalid_request
This commit is contained in:
parent
62dc6d1e92
commit
6744532183
@ -20,6 +20,21 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API.Configuration
|
||||
};
|
||||
}
|
||||
|
||||
// ApiScope is used to protect the API
|
||||
//The effect is the same as that of API resources in IdentityServer 3.x
|
||||
public static IEnumerable<ApiScope> GetApiScopes()
|
||||
{
|
||||
return new List<ApiScope>
|
||||
{
|
||||
new ApiScope("orders", "Orders Service"),
|
||||
new ApiScope("basket", "Basket Service"),
|
||||
new ApiScope("mobileshoppingagg", "Mobile Shopping Aggregator"),
|
||||
new ApiScope("webshoppingagg", "Web Shopping Aggregator"),
|
||||
new ApiScope("orders.signalrhub", "Ordering Signalr Hub"),
|
||||
new ApiScope("webhooks", "Webhooks registration Service"),
|
||||
};
|
||||
}
|
||||
|
||||
// Identity resources are data like user ID, name, or email address of a user
|
||||
// see: http://docs.identityserver.io/en/release/configuration/resources.html
|
||||
public static IEnumerable<IdentityResource> GetResources()
|
||||
@ -101,6 +116,7 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API.Configuration
|
||||
RequireConsent = false,
|
||||
AllowOfflineAccess = true,
|
||||
AlwaysIncludeUserClaimsInIdToken = true,
|
||||
RequirePkce = false,
|
||||
RedirectUris = new List<string>
|
||||
{
|
||||
$"{clientsUrl["Mvc"]}/signin-oidc"
|
||||
|
@ -76,6 +76,16 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API.Data
|
||||
|
||||
await context.SaveChangesAsync();
|
||||
}
|
||||
|
||||
if (!context.ApiScopes.Any())
|
||||
{
|
||||
foreach (var apiScope in Config.GetApiScopes())
|
||||
{
|
||||
context.ApiScopes.Add(apiScope.ToEntity());
|
||||
}
|
||||
|
||||
await context.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user