1) Enable validation (note: this snippet only works for authorizing requests within the same endpoint as the authorization server, such as the userinfo API)
services.AddOpenIddict().AddServer(()=>{// ...}).AddValidation(options=>{// Import the configuration from the local OpenIddict server instance.options.UseLocalServer();// Register the ASP.NET Core host.options.UseAspNetCore();});
2) Use the validation authentication scheme to authorize instead of the server's scheme
// Replace this://[Authorize(AuthenticationSchemes = OpenIddictServerAspNetCoreDefaults.AuthenticationScheme)]// With this:[Authorize(AuthenticationSchemes=OpenIddictValidationAspNetCoreDefaults.AuthenticationScheme)]
Awesome catch. I think I'd never figured this out if you hadn't added this.
Also in the line below, you will need to use OpenIddictValidationAspNetCoreDefaults. Then it works flawlessly.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I could not get authorization to work without:
1) Enable validation (note: this snippet only works for authorizing requests within the same endpoint as the authorization server, such as the userinfo API)
2) Use the validation authentication scheme to authorize instead of the server's scheme
Awesome catch. I think I'd never figured this out if you hadn't added this.
Also in the line below, you will need to use
OpenIddictValidationAspNetCoreDefaults
. Then it works flawlessly.