Reputation: 869
I am getting error while trying to get token for my custom scope value.Below is My code snippet.
public static IEnumerable<ApiResource> GetApis() =>
new List<ApiResource>
{
new ApiResource("ApiOne","ApiOne",new []{ "ApiOne"})
};
public static IEnumerable<Client> GetClients() =>
new List<Client> { new Client
{
ClientId="client1",
ClientSecrets={ new Secret("secret1".Sha256())},
AllowedGrantTypes={GrantType.ClientCredentials},
AllowedScopes={"ApiOne"},
AllowOfflineAccess=true,
},
};
Upvotes: 3
Views: 4085
Reputation: 869
Add ApiScope in configuration
public static List<ApiScope> Get()
{
return new List<ApiScope>
{
new ApiScope
{
Name = "ApiOne",
Emphasize=true,
},
new ApiScope
{
Name = "ApiTwo",
Emphasize=true,
},
};
}
In Startup file add
.AddInMemoryApiScopes(Configuration.Get());
Upvotes: 7