Sample app working from login link, not from Okta app

I am attempting to get the sample project found at this link working. I have configured an application in the Okta Admin console.

When I click on the “Sign In” link from the running sample application, I successfully log in (it shows my full name which it received from Okta). However, when I click on the configured app in my Okta console, I get the error Exception: OpenIdConnectAuthenticationHandler: message.State is null or empty.

I am assuming that I have misconfigured my Okta application in some way.

Some further information on this - the project I was testing is the samples-aspnetcore-7x/okta-hosted-login. I could send my code if necessary, but literally the only thing I changed was the appsettings.json file to match my Okta domain/clientid/clientSecret

Can you check that the Application’s Initiate Login URI is not the same as the redirect_uri. The callback route will then be expecting a State and an authorization code, which can then explain this error

they are in fact the same. Do they have default values that I should set? I see that the default value in the AddOktaMvc options for CallbackPath is /authorization-code/callback, and I believe this is associated with the Sign-in redirect URI. I don’t see any other configurable paths in the UseOktaMcv options except for PostLogoutRedirectUri.

So what value should I put in my Okta app for Initiate login URI

I figured out what to put in both URLs, thanks

1 Like