TransWikia.com

OAuth2 token request failing

Salesforce Asked by Varun on December 14, 2021

My access token request is failing with the following error response in HTTP Response.

{
error: “invalid_client_id”
error_description: “client identifier invalid”
}

I am trying with the Username-Password flow for OAuth.

I am testing with “Advanced REST Client” in Chrome.

enter image description here

enter image description here

This is my payload

https://login.salesforce.com/services/oauth2/token&grant_type=password&client_id=3MVG9ZL0ppGP5UrDhLqebweqGDkIkyGQRjYkfWtLLSwKDal0AhSWZIG7EU7gsYQn4JjfCt.SOoBrJLmyEpslT&clientSecret=7217724494220744623&[email protected]&password=qazwsx123UKBZb1SEA3LgCcptvGBb8ibpk

All my credentials are correct and I am stuck.

My connected app settings (Client Key/Secret) are also right without any typos and such.

Can someone help as to what could be wrong ?

4 Answers

I got the same error and what fixed it was choosing "Send client credentials in body" in the "Client Authentication" dropdown.

PostMan built-in oAuth

Answered by pkamathk on December 14, 2021

When you are making a POST request on Postman, to retrieve the SF access token, you must append the Security Token with the Password (i.e. yourpasswordxxxxx , where xxxxx is your security token).

The security key can be found in Salesforce by clicking on your name -> settings -> my personal information -> reset my security token -> On clicking Reset Security Token a new security token will be sent to your email.

Thus, the below payload should be your API URL (where XXXXXXXXXX is your security token).

https://login.salesforce.com/services/oauth2/token&grant_type=password&client_id=3MVG9ZL0ppGP5UrDhLqebweqGDkIkyGQRjYkfWtLLSwKDal0AhSWZIG7EU7gsYQn4JjfCt.SOoBrJLmyEpslT&client_secret=7217724494220744623&[email protected]&password=qazwsx123UKBZb1SEA3LgCcptvGBb8ibpkXXXXXXXXXX

Note : Before calling the above API you must first configure your SF Connected App, where you should Enable OAuth Settings and set https://www.getpostman.com/oauth2/callback as your Callback URL.

Hope this helps, Thanks,

Parikhit

Answered by Parikhit Sarkar on December 14, 2021

After testing in postman i got a success response.

The only change i have made is given below

clientSecret -> client_secret

And the call should be a POST call.

If you need anything else you can comment bellow.

Answered by asitm9 on December 14, 2021

Okay, I see that there are one thing wrong with your request. There should be no space/enter in the client Id. I see that there is an enter in your request in Postman.

I tried the same request after removing the enter and got invalid client credentials instead of invalid client identifier. Possibly the one you have provided here have been changed.

Answered by manjit5190 on December 14, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP