# Unauthorized error on retrieving access token using /oauth0/token api

**URL:** <https://community.auth0.com/t/unauthorized-error-on-retrieving-access-token-using-oauth0-token-api/111362>\
**Category:** Get Help\
**Tags:** users, management-api\
**Created:** [July 16, 2023, 7:37am UTC](https://community.auth0.com/t/unauthorized-error-on-retrieving-access-token-using-oauth0-token-api/111362 "2023-07-16T07:37:44Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![vijayakalidhas-impt](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@vijayakalidhas-impt](https://community.auth0.com/u/vijayakalidhas-impt)\
**Post date:** [July 16, 2023, 7:37am UTC](https://community.auth0.com/t/unauthorized-error-on-retrieving-access-token-using-oauth0-token-api/111362/1 "2023-07-16T07:37:45Z")

</div>

**Summary** : As part of our new requirement to have in-app signup & login experience, we enabled the password grant for the application in dev, test, and prod. We successfully created user accounts (signup) but could not get user access tokens from the API (/oauth/token). _ **This is working fine in our DEV tenant.** _  
Currently, this is blocking us from delivering the in-app experience.

**Debug details** :  
**PROD tenant curl request (not working):**

```auto
curl --location 'https://<our-auth0-domain-url>/oauth/token'
--header 'Content-Type: application/x-www-form-urlencoded'
--data-urlencode 'grant_type=password'
--data-urlencode 'client_id=<our-client-id>'
--data-urlencode 'audience=https://my-audience'
--data-urlencode 'username=myemail@gmail.com'
--data-urlencode 'password=XXXXXXXXX'
--data-urlencode 'scope=openid email profile offline_access'

```

Response:

```auto
{
"error": "access_denied",
"error_description": "Unauthorized"
}

```

**Update:**

As we have the SPA application created and working in DEV tenant, I created a new SPA application in PROD tenant, but it is still not working and received a different error now.

**Response:**

```auto
{
"error": "server_error",
"error_description": "Authorization server not configured with default connection."
}

```

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [July 17, 2023, 2:46pm UTC](https://community.auth0.com/t/unauthorized-error-on-retrieving-access-token-using-oauth0-token-api/111362/3 "2023-07-17T14:46:30Z")

</div>

Hi @vijayakalidhas-impt,

Welcome to the Auth0 Community!

Have you seen this thread?

> <https://stackoverflow.com/questions/69419470/auth0-error-authorization-server-not-configured-with-default-connection>

---

<div class="post-metadata">

**Author:** ![vijayakalidhas-impt](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@vijayakalidhas-impt](https://community.auth0.com/u/vijayakalidhas-impt)\
**Post date:** [July 18, 2023, 10:50am UTC](https://community.auth0.com/t/unauthorized-error-on-retrieving-access-token-using-oauth0-token-api/111362/4 "2023-07-18T10:50:18Z")

</div>

@dan.woda Thanks so much. I got this fixed.  
I made two changes in my Auth0 config and posting the fix here.

Fix 1:  
Settings \> General (tab) \> API Authorization Settings \> Default Directory ==\> set value to Username-Password-Authentication

 ![image](https://global.discourse-cdn.com/auth0/original/3X/7/3/7375eefd3a37010893746d5d1ab23dd8b2a33a24.png)

Fix 2:  
Application \> (click application name) \> Credential (tab) \> Authentication Methods \> (Select None)

 ![image](https://global.discourse-cdn.com/auth0/original/3X/6/d/6dd9c2753f69f2e8e6d9e9ec9ab043ea18ca7839.png)

I hope this helps our community.

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [July 18, 2023, 1:46pm UTC](https://community.auth0.com/t/unauthorized-error-on-retrieving-access-token-using-oauth0-token-api/111362/5 "2023-07-18T13:46:22Z")

</div>

Awesome! Thanks for following up!

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [August 1, 2023, 1:47pm UTC](https://community.auth0.com/t/unauthorized-error-on-retrieving-access-token-using-oauth0-token-api/111362/6 "2023-08-01T13:47:01Z")

</div>

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