# Openid authentication is not working in prod okta account, but works in dev account

**URL:** <https://devforum.okta.com/t/openid-authentication-is-not-working-in-prod-okta-account-but-works-in-dev-account/26112>\
**Category:** OAuth/OIDC\
**Created:** [December 18, 2023, 6:22pm UTC](https://devforum.okta.com/t/openid-authentication-is-not-working-in-prod-okta-account-but-works-in-dev-account/26112 "2023-12-18T18:22:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![sonaru](https://avatars.discourse-cdn.com/v4/letter/s/0ea827/32.png) [@sonaru](https://devforum.okta.com/u/sonaru)\
**Post date:** [December 18, 2023, 6:22pm UTC](https://devforum.okta.com/t/openid-authentication-is-not-working-in-prod-okta-account-but-works-in-dev-account/26112/1 "2023-12-18T18:22:07Z")

</div>

I configured my app integration with dev okta account following this instruction: [Flask Tutorial: Simple User Registration and Login | Okta Developer](https://developer.okta.com/blog/2018/07/12/flask-tutorial-simple-user-registration-and-login). However, when I try to do the same steps for the prod okta account it doesn’t work:  
`401 Client Error: Unauthorized for url: https://{orgname}.oktapreview.com/oauth2/default/.well-known/openid-configuration.`  
Authentication policies for app in both accounts are identical.  
I also noticed that in the dev account OIDC identity provider was automatically created, which was not the case in the prod account, so I created an identity provider in the prod account myself, but still no success.  
I double-checked client\_id, client\_secret, domain, and API token.

I would appreciate any ideas of what I can be missing here.

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

---

<div class="post-metadata">

**Author:** ![andrea](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/andrea/32/2172_2.png) [@andrea](https://devforum.okta.com/u/andrea)\
**Post date:** [December 18, 2023, 6:30pm UTC](https://devforum.okta.com/t/openid-authentication-is-not-working-in-prod-okta-account-but-works-in-dev-account/26112/2 "2023-12-18T18:30:42Z")

</div>

Does your Prod Okta org have the ability to use the [Default Authorization Server](https://developer.okta.com/docs/concepts/auth-servers/#default-custom-authorization-server) (typically, this requires the API Access Management license)?

If not, you will want to look to use the [Org Authorization Server](https://developer.okta.com/docs/concepts/auth-servers/#org-authorization-server) instead, which means your endpoints will need to be updated. For example, the `auth_uri` will need to change from `https://OktaDomain/oauth2/default/v1/authorize` to `https://OktaDomain/oauth2/v1/authorize`, and so on.

---

<div class="post-metadata">

**Author:** ![sonaru](https://avatars.discourse-cdn.com/v4/letter/s/0ea827/32.png) [@sonaru](https://devforum.okta.com/u/sonaru)\
**Post date:** [December 18, 2023, 7:06pm UTC](https://devforum.okta.com/t/openid-authentication-is-not-working-in-prod-okta-account-but-works-in-dev-account/26112/3 "2023-12-18T19:06:37Z")

</div>

In security → API I don’t have Server tab, I guess that means that we are not able to use default server (is it possible that I just miss some permissions in admin account?). If I just remove `default` from all urls, I get

`404 Client Error: Not Found for url: https://{org}.oktapreview.com/oauth2/.well-known/openid-configuration`

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

---

<div class="post-metadata">

**Author:** ![andrea](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/andrea/32/2172_2.png) [@andrea](https://devforum.okta.com/u/andrea)\
**Post date:** [December 18, 2023, 7:11pm UTC](https://devforum.okta.com/t/openid-authentication-is-not-working-in-prod-okta-account-but-works-in-dev-account/26112/4 "2023-12-18T19:11:06Z")

</div>

Yup, if you don’t see Security → API → Authorization Servers, you won’t be able to use a custom Authorization Server. The correct well-known endpoint for the Org AS is `https://{org}.oktapreview.com/.well-known/openid-configuration`

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/oktadev/original/1X/589c4c5f80de422d01f47cee7185a7fb8227835c.png) [@system](https://devforum.okta.com/u/system)\
**Post date:** [December 19, 2023, 7:11pm UTC](https://devforum.okta.com/t/openid-authentication-is-not-working-in-prod-okta-account-but-works-in-dev-account/26112/5 "2023-12-19T19:11:34Z")

</div>

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.
