OKTA : Getting 403 - Forbidden: Access is denied error

1k Views Asked by At

I have web server behind the load balancer, system successfully redirected me to OKTA login page, after entering the credentials when I and hitting the login button when OKTA server perform the callback action using

"https://www.mywebservername.com/authorization-code/callback"

I am getting an error:

403 - Forbidden: Access is denied. You do not have permission to view this directory or page using the credentials that you supplied.

I am using below code in startup.cs file, my application in Blazor server

.AddOpenIdConnect(options =>

      {

        options.ClientId = Configuration["Okta:ClientId"];

        options.ClientSecret = Configuration["Okta:ClientSecret"];

        options.CallbackPath = "/authorization-code/callback";

        options.Authority = Configuration["Okta:Issuer"];

        options.ResponseType = "code";

        options.SaveTokens = true;

        options.Scope.Add("openid");

        options.Scope.Add("profile");

        options.TokenValidationParameters.ValidateIssuer = false;

        options.TokenValidationParameters.NameClaimType = "name";

        })

      .AddCookie();

Can you please help me to fix this problem.

1

There are 1 best solutions below

0
On

Try adding the following to web.config file:

<allow  users="?" />

More details here: https://learn.microsoft.com/en-us/previous-versions/dotnet/netframework-1.1/8d82143t(v=vs.71)?redirectedfrom=MSDN