Skip to main content
Solved

unauthorized_client when getting token using resource owner password credentials flow

  • September 19, 2022
  • 2 replies
  • 632 views

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

Troy Vars wrote:

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
Did this topic help you find an answer to your question?

2 replies

Troy Vars
Semi-Pro I
Forum|alt.badge.img+1
  • Semi-Pro I
  • 54 replies
  • October 7, 2022

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


Forum|alt.badge.img
  • Author
  • Jr Varsity I
  • 15 replies
  • Answer
  • October 12, 2022
Troy Vars wrote:

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.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings