# Resource Owner Password authentication failure

**URL:** <https://community.auth0.com/t/resource-owner-password-authentication-failure/67218>\
**Category:** Get Help\
**Tags:** resource-owner-passw\
**Created:** [August 2, 2021, 10:34am UTC](https://community.auth0.com/t/resource-owner-password-authentication-failure/67218 "2021-08-02T10:34:03Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![abelose90](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/abelose90/32/30850_2.png) [@abelose90](https://community.auth0.com/u/abelose90)\
**Post date:** [August 2, 2021, 10:34am UTC](https://community.auth0.com/t/resource-owner-password-authentication-failure/67218/1 "2021-08-02T10:34:04Z")

</div>

Current setup: Created a SPA, added a rule to add roles of the logged in user. This role is checked while accessing the apis. Added grant type password.

My usecase: I am trying to run postman tests. For testing apis I need bearer token. By using Resource Owner Password flow I was trying to obtain the bearer token.  
Here is my curl command,  
`curl --location --request POST 'https://my-second-tenant.eu.auth0.com/oauth/token?grant_type=password&username=username&password=password&audience=https://quickstarts/api&client_id=%23%23%23%23%23%23%23%23%23&client_secret= *****'`

I am getting  
`{ "error": "access_denied", "error_description": "Unauthorized" }`

I have already checked the password grant type is enabled. I also tried disabling the rule just to check if rule is causing any problem but no luck.  
Am I missing anything here?

I also came across Client credentials flow and that could be a good option. But I am using SPA application type.  
My second question is, as this is SPA so the client credentials option is disabled.  
Is there any way that I could configure my SPA to allow client credential.

---

<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:** [August 3, 2021, 7:06pm UTC](https://community.auth0.com/t/resource-owner-password-authentication-failure/67218/3 "2021-08-03T19:06:07Z")

</div>

Hi again @abelose90,

Can you try omitting the client secret?

If you are using a SPA type application you should omit it from the [token request](https://auth0.com/docs/flows/call-your-api-using-resource-owner-password-flow#request-tokens).

 ![Screen Shot 2021-08-03 at 12.05.26 PM](https://global.discourse-cdn.com/auth0/original/3X/9/b/9b3c141d595c67e94fd8c69d767cd78d694d5b34.png)

---

<div class="post-metadata">

**Author:** ![abelose90](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/abelose90/32/30850_2.png) [@abelose90](https://community.auth0.com/u/abelose90)\
**Post date:** [August 4, 2021, 5:54am UTC](https://community.auth0.com/t/resource-owner-password-authentication-failure/67218/4 "2021-08-04T05:54:10Z")

</div>

Hi @dan.woda

> [@dan.woda](#):
>
> Can you try omitting the client secret?

Yes I did.  
Here is my request

```auto
https://my-second-tenant.eu.auth0.com/oauth/token?grant_type=password&username={{username}}&password={{password}}&audience=https://quickstarts/api&scope=openid profile email&client_id={{auth0_clientid}}

```

Followed all the steps from [here](https://auth0.com/docs/flows/call-your-api-using-resource-owner-password-flow?_ga=2.33953185.1610404109.1627884819-1348151522.1627451414&_gl=1*2swv80*rollup_ga*MTM0ODE1MTUyMi4xNjI3NDUxNDE0*rollup_ga_F1G3E656YZ*MTYyODA1MjYyOS4yMS4xLjE2MjgwNTYwNzAuMzg.#request-tokens)

But still getting

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

```

---

<div class="post-metadata">

**Author:** ![abelose90](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/abelose90/32/30850_2.png) [@abelose90](https://community.auth0.com/u/abelose90)\
**Post date:** [August 4, 2021, 9:25am UTC](https://community.auth0.com/t/resource-owner-password-authentication-failure/67218/5 "2021-08-04T09:25:04Z")

</div>

Hi @dan.woda  
I think I got what I was doing wrong. I was sending the parameters as query parameters but I was suppose to send the parameters **in the request body** using `application/x-www-form-urlencoded` encoding.  
I got my answer from here:

> [@Custom login form (with username and password) Error: access\_denied](https://community.auth0.com/t/custom-login-form-with-username-and-password-error-access-denied/36663/3):
>
> Thank you! slight_smile

Thank you!

---

<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:** [August 4, 2021, 3:42pm UTC](https://community.auth0.com/t/resource-owner-password-authentication-failure/67218/6 "2021-08-04T15:42:43Z")

</div>

Yes, you must send the data in the body. Glad you found a solution.

---

<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 19, 2021, 3:43pm UTC](https://community.auth0.com/t/resource-owner-password-authentication-failure/67218/7 "2021-08-19T15:43:06Z")

</div>

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