Skip to main content
Solved

unauthorized_client when getting token using resource owner password credentials flow

  • Sep 19, 2022 10:20 PM UTC
  • 2 replies
  • 911 views
  • Translate All

Forum|alt.badge.img
{
'client_id': "xxxxxxx@company",
'client_secret': "xxxxxxxxxx",
'grant_type': 'client_credentials',
# 'grant_type': 'password',
'scope': "api",
'username': 'xxxx',
'password': 'xxxx',
}

This is the body I am sending, but I am getting `{'error': 'unauthorized_client'}` what am I missing?

Secondly, the documentation says the grant_type must set to `password`, but if I do that, I get `invalid_grant`

Best answer by jamesl

You seem to be attempting to connect application using the Access Token Request Endpoint. 

Is your application set up on the SM.30.30.10 Connected Applications Screen within Acumatica? 

Also your request body seems to be missing the redirect URI for Acumatica to send requests to your application.

I think this is the documentation you are referring to in your question

https://help-2022r1.acumatica.com/Help?ScreenId=ShowWiki&pageid=ff780860-09c2-46c9-bdd7-c6c3b1fc442c

Thanks for the reply, unfortunately the unauthorized error was due to `'grant_type': 'client_credentials'`, which is not accepted in Acumentica, The correct grant_type was actually `password`. 

When I had `grant_type` being `password` and got the `invalid grant` error, it was due to the admin not setup the API access correctly.

View original

2 replies

Troy Vars
Semi-Pro II
Forum|alt.badge.img+3
  • Semi-Pro II
  • Oct 7, 2022 5:49 PM UTC

You seem to be attempting to connect application using the Access Token Request Endpoint. 

Is your application set up on the SM.30.30.10 Connected Applications Screen within Acumatica? 

Also your request body seems to be missing the redirect URI for Acumatica to send requests to your application.

I think this is the documentation you are referring to in your question

https://help-2022r1.acumatica.com/Help?ScreenId=ShowWiki&pageid=ff780860-09c2-46c9-bdd7-c6c3b1fc442c

Translate

Forum|alt.badge.img
  • Author
  • Jr Varsity I
  • Answer
  • Oct 12, 2022 7:48 PM UTC

You seem to be attempting to connect application using the Access Token Request Endpoint. 

Is your application set up on the SM.30.30.10 Connected Applications Screen within Acumatica? 

Also your request body seems to be missing the redirect URI for Acumatica to send requests to your application.

I think this is the documentation you are referring to in your question

https://help-2022r1.acumatica.com/Help?ScreenId=ShowWiki&pageid=ff780860-09c2-46c9-bdd7-c6c3b1fc442c

Thanks for the reply, unfortunately the unauthorized error was due to `'grant_type': 'client_credentials'`, which is not accepted in Acumentica, The correct grant_type was actually `password`. 

When I had `grant_type` being `password` and got the `invalid grant` error, it was due to the admin not setup the API access correctly.

Translate