I get the following error when accessing my Identity Server application from my Javascript client application.
fail: IdentityServer4.Validation.ScopeValidator [0] Invalid scope: openid
I added that I am adding scope to the Identity Server application. Below is my code.
IdentityServer application (host) Config.cs
public class Config { public static IEnumerable<ApiResource> GetApiResources() { return new List<ApiResource> { new ApiResource("api1","My API") }; } public static IEnumerable<Client> GetClients() { return new List<Client> { new Client { ClientId = "js", ClientName = "javaScript Client", AllowedGrantTypes = GrantTypes.Implicit, AllowAccessTokensViaBrowser = true, RedirectUris = { "http://localhost:5003/callback.html" }, PostLogoutRedirectUris = { "http://localhost:5003/index.html" }, AllowedCorsOrigins = { "http://localhost:5003" }, AllowedScopes = { IdentityServerConstants.StandardScopes.OpenId, IdentityServerConstants.StandardScopes.Profile, "api1" } } }; } }
Startup.cs
public class Startup {
Web API Startup.cs
public class Startup { public Startup(IHostingEnvironment env) { var builder = new ConfigurationBuilder() .SetBasePath(env.ContentRootPath) .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true); if (env.IsEnvironment("Development")) {
source share