401 Unauthorized code sign-in widget

Hello guys,

I am following the “Okta Spring Security & Custom Login Page Example” - custom-login guide (github.com/okta/samples-java-spring/tree/master/custom-login). I just downloaded the project and started with my oktaDomain, clientId and clientSecret then I go to localhost:8080, login widget. There I put my email and password to auntenticate.

mvn -Dokta.oauth2.issuer={yourOktaDomain}/oauth2/default
-Dokta.oauth2.clientId={clientId}
-Dokta.oauth2.clientSecret={clientSecret}

However, in the network tab I see Okta return a 401 Unauthorized code, however my user is inside my IdP. So, what is happening?

POST https://dev-422935.okta.com/api/v1/authn - RESPONSE 401 Unauthorized

If I test such request using postman (http s://dev-422935.okta.com/api/v1/authn) I receives the same 401 code.

In my okta dashboard we can see the IdP

And inside the HancockBank group lives the user LidiaH@cofensetest.onmicrosoft.com

Also, in my “Routing rules” I say that Identity provider “AAD cofensetest.onmicrosoft.com” must be used if a user with domain cofensetest.onmicrosoft.com tries to authenticate.

So, I do not see why I am receiving the “401 Unauthorized code” when the project “custom-login” tries to authenticate using https ://dev-422935.okta.com/api/v1/authn

Can you please provide me support? Thanks a lot

@JulioQuiroz Hi,
Could you please open a support ticket through an email to support@okta.com. One of our dev support engineers will help you review your code and configuration.

1 Like

Thank you, i just send the email and waiting for respose.

Cool. I’ll close this topic then.