Authorization Required: Unauthorized pub.client:http

Hi,
I am getting the below error “Authorization Required: Unauthorized” while trying to get the Token from the Token URL using pub.client:http
Below are the parameters I am giving.
client_id
client_secret
grant_type = client_credentials
url = token url
method = post


But I am able to generate the token and post the message successfully through postman using OAuth2.0. Can you please let me know what is missing in the call I am making to pub.client:http to get the access token?

From your Postman screen shot it is using basic auth to send the credentials and a single field for the grant_type.

And the IS http call is using only the form fields, not basic auth.

Perhaps the server only supports the former (seems odd).

Or perhaps something is amiss with the URL? Is the tail of the URL /oauth/token?

I also tried with giving client_authentication = Basic but still the same error.
The Access Token URL ends like this - xxx/oauth2/token/generate

Can you share exactly how you did this? If you use Basic auth in wM IS, you’d pass the credentials within the auth document and only the grant_type field under args. There would not be anything named “client_authentication”.

What might help is if you review the Console, and perhaps “Show raw log”, within Postman to see what it does. Based upon your screen shot, it should look something like this:

As can be seen here, Basic auth is used in the Authorization header, and the x-www-form-urlencoded form has just one field. To do the same in wM IS:

data/args/grant_type = client_credentials
auth/type = Basic
auth/user = (map from client_id)
auth/pass = (map from client_secret)

wM IS automatically sets the Content-Type.

1 Like

That’s amazing! I just followed what you gave and it worked perfectly!!! Thanks a ton! :slightly_smiling_face:

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