# 401 Unauthorized code sign-in widget

**URL:** <https://devforum.okta.com/t/401-unauthorized-code-sign-in-widget/12976>\
**Category:** Questions\
**Created:** [February 18, 2021, 12:13am UTC](https://devforum.okta.com/t/401-unauthorized-code-sign-in-widget/12976 "2021-02-18T00:13:36Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![JulioQuiroz](https://avatars.discourse-cdn.com/v4/letter/j/d78d45/32.png) [@JulioQuiroz](https://devforum.okta.com/u/JulioQuiroz)\
**Post date:** [February 18, 2021, 12:13am UTC](https://devforum.okta.com/t/401-unauthorized-code-sign-in-widget/12976/1 "2021-02-18T00:13:36Z")

</div>

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](http://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?

 ![image](https://global.discourse-cdn.com/oktadev/original/2X/1/1c4f1748a644b38b2cc0bbbe09561938d5bdb9c3.png)

**POST [https://dev-422935.okta.com/api/v1/authn](https://dev-422935.okta.com/api/v1/authn) - RESPONSE 401 Unauthorized**

 ![image](https://global.discourse-cdn.com/oktadev/original/2X/9/91c1ab5908aef4cd921a5002ef56caa7a7d67cdb.png)

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

 ![image](https://global.discourse-cdn.com/oktadev/original/2X/8/8c399c1ab28cb6f3ba840fda2f05d057dc85013d.png)

In my okta dashboard we can see the IdP

 ![image](https://global.discourse-cdn.com/oktadev/original/2X/a/a43d17d4022710ebb56fba24e72f63e707460bde.jpeg)

And inside the HancockBank group lives the user [LidiaH@cofensetest.onmicrosoft.com](mailto:LidiaH@cofensetest.onmicrosoft.com)

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

 ![image](https://global.discourse-cdn.com/oktadev/original/2X/a/a8bf496f8c77944cb418459209dddadd853a3090.png)

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

---

<div class="post-metadata">

**Author:** ![Lijia](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/lijia/32/2295_2.png) [@Lijia](https://devforum.okta.com/u/Lijia)\
**Post date:** [February 18, 2021, 12:22am UTC](https://devforum.okta.com/t/401-unauthorized-code-sign-in-widget/12976/2 "2021-02-18T00:22:18Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![JulioQuiroz](https://avatars.discourse-cdn.com/v4/letter/j/d78d45/32.png) [@JulioQuiroz](https://devforum.okta.com/u/JulioQuiroz)\
**Post date:** [February 18, 2021, 3:22pm UTC](https://devforum.okta.com/t/401-unauthorized-code-sign-in-widget/12976/4 "2021-02-18T15:22:03Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Lijia](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/lijia/32/2295_2.png) [@Lijia](https://devforum.okta.com/u/Lijia)\
**Post date:** [February 18, 2021, 7:27pm UTC](https://devforum.okta.com/t/401-unauthorized-code-sign-in-widget/12976/5 "2021-02-18T19:27:14Z")

</div>

Cool. I’ll close this topic then.

---

<div class="post-metadata">

**Author:** ![Lijia](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/lijia/32/2295_2.png) [@Lijia](https://devforum.okta.com/u/Lijia)\
**Post date:** [February 18, 2021, 7:27pm UTC](https://devforum.okta.com/t/401-unauthorized-code-sign-in-widget/12976/6 "2021-02-18T19:27:17Z")

</div>

Closed on February 18, 2021, 7:27pm UTC


