-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Can the .NET Core OpenID Connect Library be used with the authorization code flow and Aidbox? I've been struggling for a week to implement it, and can get it to the point I receive the code, but then I get the following error:
SecurityTokenException: Unable to validate the 'id_token', no suitable ISecurityTokenValidator was found for: ''."
Here's the Client setup I'm using:
auth:
authorization_code:
redirect_uri: 'https://localhost:44312/signin-oidc'
secret: verysecret
grant_types:
- code
id: web-app
resourceType: Client
meta:
lastUpdated: '2021-07-09T14:43:13.826665Z'
createdAt: '2021-07-09T02:26:10.341542Z'
versionId: '218'
I'm using pretty much boilerplate code for the authorization code flow in .NET Core. Here's my ConfigureServices method:
public void ConfigureServices(IServiceCollection services)
{
services.AddRazorPages();
services.AddServerSideBlazor();
// OpenID Connect configuration
services.AddAuthentication(options =>
{
options.DefaultScheme = "Cookies";
options.DefaultChallengeScheme = "oidc";
})
.AddCookie()
.AddOpenIdConnect("oidc", options =>
{
options.Authority = "https://solventustest.aidbox.app";
options.ClientId = "web-app";
options.ClientSecret = "verysecret";
options.ResponseType = "code";
options.TokenValidationParameters = new TokenValidationParameters
{
ValidateIssuerSigningKey=false,
ValidateIssuer = false
};
options.SaveTokens = true;
options.GetClaimsFromUserInfoEndpoint = true;
options.Events = new OpenIdConnectEvents
{
// called if user clicks Cancel during login
OnAccessDenied = context =>
{
context.HandleResponse();
context.Response.Redirect("/");
return Task.CompletedTask;
}
};
}); }
This same kind of code works great with IdentityServer, and all the big-name OpenID Connect providers I've tried it with, like Google and Facebook.