Hi Oktanoids,
I am a complete newbie to OIDC, please go easy on me :). I’ve followed the example for an MVC Core test at https://developer.okta.com/blog/2017/06/29/oidc-user-auth-aspnet-core for net7.0.
Firstly this 2017 example seems rather dated (screens are somewhat different and the packages deprecated) but I’ve cobbled together something that builds, after I changed the authentication part to
. . .
. . .
builder.Services.AddAuthentication(options =>
{
options.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme;
options.DefaultChallengeScheme = OpenIdConnectDefaults.AuthenticationScheme;
options.DefaultAuthenticateScheme = "oidc";
options.DefaultSignInScheme = "Cookies";
})
.AddCookie()
.AddOpenIdConnect(options =>
{
options.Authority = "the variants below";
options.RequireHttpsMetadata = false;
options.ClientId = "<my Client Id>";
options.ClientSecret = "<my Client Secret key thingy>";
options.ResponseType = "id_token token";
options.Scope.Add("openid");
options.Scope.Add("profile");
options.Scope.Add("email");
});
. . .
. . .
The bit that I’m baffled by is what Authority I need to use. I’ve tried the following variants from the Application Dashboard, and a few more, and none of them seems to give me any sort of login
options.Authority = "https://dev-12345678.okta.com/oauth2/default";
options.Authority = "https://dev-12345678.okta.com/.well-known/openid-configuration";
options.Authority = "https://dev-12345678.okta.com/oauth2/default/.well-known/oauth-authorization-server";
options.Authority = "https://dev-12345678.okta.com/api/v1/authorizationServers/default";
options.Authority = "https://dev-12345678.okta.com/oauth2/default/v1/authorize";
ie. when I try accessing https://localhost:5000/Home/Secure I get various responses ranging from a 404, ‘Unable to obtain configuration from: …’, ‘PII of type ‘System.String’ is hidden’, JSON with ‘E0000022 The endpoint does not support the provided HTTP method’, a large JSON payload with issuer/authorization endpoint/token endpoint etc. but those haven’t worked for me either.
I’m a bit lost on this sorry, any ideas for me to try?
Thanks
Steve