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


    "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


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

| improve this answer | |
  • 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 Mar 28 '18 at 12:25
  • @AbhikDey Yes you are correct. – Tushar Sharma Mar 28 '18 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 Mar 28 '18 at 12:31
  • @AbhikDey You are getting status code. Try to google that in Salesforce docs. – Tushar Sharma Mar 28 '18 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&username=test123@gmail.com&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

| improve this answer | |
  • 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 Mar 30 '18 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 Mar 30 '18 at 1:46
  • @Abhik Dey iam getting see my screen shot then you get some idea – pkharries Mar 30 '18 at 4:56
  • may be what the hell I am missing...it is so simple but eating my brain like anything – Abhik Dey Mar 30 '18 at 11:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.