
KechengL.63420 (Customer) asked a question.
The sample code I user is from https://github.com/okta/samples-aspnetcore.
the controller
[HttpPost]
[ValidateAntiForgeryToken]
public IActionResult SignIn([FromForm] string sessionToken)
{
if (!HttpContext.User.Identity.IsAuthenticated)
{
var properties = new AuthenticationProperties();
properties.Items.Add("sessionToken", sessionToken);
properties.RedirectUri = "/Home/";
return Challenge(properties, OktaDefaults.MvcAuthenticationScheme);
}
return RedirectToAction("Index", "Home");
}
the program.cs
builder.Services.AddAuthentication(options =>
{
options.DefaultAuthenticateScheme = CookieAuthenticationDefaults.AuthenticationScheme;
options.DefaultSignInScheme = CookieAuthenticationDefaults.AuthenticationScheme;
options.DefaultChallengeScheme = CookieAuthenticationDefaults.AuthenticationScheme;
})
.AddCookie(options =>
{
options.LoginPath = new PathString("/Account/SignIn");
})
.AddOktaMvc(new OktaMvcOptions
{
// Replace these values with your Okta configuration
OktaDomain = builder.Configuration.GetValue<string>("Okta:OktaDomain"),
ClientId = builder.Configuration.GetValue<string>("Okta:ClientId"),
ClientSecret = builder.Configuration.GetValue<string>("Okta:ClientSecret"),
AuthorizationServerId = builder.Configuration.GetValue<string>("Okta:AuthorizationServerId"),
Scope = new List<string> { "openid", "profile", "email" },
});
Thanks

Hi @KechengL.63420 (Customer) , Thank you for reaching out to the Okta Community!
The following article might help your use case:
https://help.okta.com/en-us/Content/Topics/Settings/settings-configure-app-error-page.htm
My advice would also be to reach out to the dedicated Developer Forum devforum.okta.com to take advantage of their expertise.
While we'll do our best to answer all of your questions here, this medium is more inclined towards Okta core products and features.
If my answer helped, remember to mark it as best to increase its visibility for other members of the Okta Community who might have the same questions as you.
Hope my answer helps!
--------------------------------
Community members help others by clicking Like or Select as Best on responses. Try it today.
Thank you so much Mihai for quick response.
I use OpenID Connect and Web Application to create an okta application, but I could not find "App Embed Link" section. in General tab.
I use the following instructions to setup redirect error page, such as https://localhost:5001/OktaError. it does not work, it shows https://localhost:5001/authorization-code/callback and error is OpenIdConnectProtocolException: Message contains error: 'access_denied', error_description: 'User is not assigned to the client application.', error_uri: 'error_uri is null'.
The application is .net 6 Blazor server application
Thanks