3

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 ?

6
  • As the error saying itself I'm confused what's that grant_type in your request. It looks like some code
    – highfive
    Commented Sep 19, 2015 at 11:05
  • The error message is not from my payload.. It is given by the Rest client after processing my payload.
    – Varun
    Commented Sep 19, 2015 at 11:06
  • 1
    error message is fine, am asking the value for grant_type in your request. It looks like some generated code where it shouldn't be as I think
    – highfive
    Commented Sep 19, 2015 at 11:13
  • You are absolutely right !!!..Let me repush with the correct payload
    – Varun
    Commented Sep 19, 2015 at 11:14
  • grant type error no longer occurs as expected but i am getting this error now..I have updated the post with the latest behaviour. The hardcoded username/password is right and can you let me know as to where should i start looking now ?..thanks
    – Varun
    Commented Sep 19, 2015 at 11:20

4 Answers 4

5

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

2

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.

2

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

1

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .