I have created a connected app in salesforce so that the external system can connect to our org.

They are using oauth2 so i have set it up accordingly and shared the client key and client secret.


But while I am trying to access the same from postman tool, I am getting 'grant type not supported '

is it client credentials is not supported in salesforce to get the token .

Also if I change to password , it says

https://test.salesforce.com/services/oauth2/token?grant_type=password&client_id=3MVG9lcxCTdG2Vbs7E5OwQecRVkliAxcnCh4dEoJtZfP1P.5Wb5n8IFFP69b.SJ2faiw4_jh1&client_secret=370769049890&[email protected]&password=237857235237645

    "error": "invalid_grant",
    "error_description": "authentication failure"

I tried with security token as well no luck.

But I have to use client_credentials only as grant type as the external system wanted that.

Can any1 help ! enter image description here

2 Answers 2


You are getting exception in first type because grant_type=client_credentials is not a correct value. Salesforce only support authorization_code or password.

In your case you need the authorization_code. First you need to get the authorization code and then using that code in your request you will get access token.

This is how your sample request will look like with code

POST /services/oauth2/token HTTP/1.1
Host: login.salesforce.com 

Understanding the Web Server OAuth Authentication Flow

In the username-password flow you might need to append your security token to get the Accesstoken from user.

Understanding the Username-Password OAuth Authentication Flow

  • Does it mean client credentials is not supported in salesforce oAuth2.0 so I can't use that ? I have to use auth code and password flow only here
    – Abhik Dey
    Commented Mar 28, 2018 at 12:25
  • @AbhikDey Yes you are correct. Commented Mar 28, 2018 at 12:26
  • I just tried with password as grant type : - test.salesforce.com/services/oauth2/… and still it says { "error": "invalid_grant", "error_description": "authentication failure" } tried with security token and without token....is their any way I can see some goood logs what causing the issue
    – Abhik Dey
    Commented Mar 28, 2018 at 12:31
  • @AbhikDey You are getting status code. Try to google that in Salesforce docs. Commented Mar 28, 2018 at 12:38

@Abhik Dey use like this https://login.salesforce.com/services/oauth2/token?grant_type=password&client_id=3MVG9ZL0ppGP5UrC5JDWLwQDrf6JviH8U3N60lZZtkwLkcMLcbfGbmuKJa_LqEpfumGXRoBiqexD.ot.rk84Z &client_secret=6234465375317883048&[email protected]&password=test@505&Content-Type=application/x-www-form-urlencoded its working for me use POST method and replace with your credentials and check it enter image description here

  • Hi, I tried excatly the same one you posted just replacing the necessary details but still i get this { "error": "invalid_grant", "error_description": "authentication failure" } I tried with security token as well and also in the app i made it as Relax IP restrcitions but still no luck
    – Abhik Dey
    Commented Mar 30, 2018 at 1:25
  • In postman if i use the option "send client credential in body" , i gt the token response but if i use "send as basic auth" i get the invalid grant error. I attached the postmanscreenshot
    – Abhik Dey
    Commented Mar 30, 2018 at 1:46
  • @Abhik Dey iam getting see my screen shot then you get some idea
    – Ravi.A
    Commented Mar 30, 2018 at 4:56
  • No luck drive.google.com/file/d/1PVJpwnCgaxuMQViaHG3su3ICJsFXLu1w/…
    – Abhik Dey
    Commented Mar 30, 2018 at 11:42
  • may be what the hell I am missing...it is so simple but eating my brain like anything
    – Abhik Dey
    Commented Mar 30, 2018 at 11:42

You must log in to answer this question.

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