1

I am working on salesforce client integration. I want to get access token and i am using

URL : https://login.salesforce.com/services/oauth2/token

  Method : Post

  Header : Content-Type: application/x-www-form-urlencoded

 grant_type=password

client_id=XXXXXXXXXX

client_secret=XXXXXXXXXX

username=XXXXXXXXXX

password=XXXXXXXXXX

Above credential working fine with grant_type=authorization_code but while i switched to grant type password then its gives me

"http/1.1 400 bad request"
{"error":"invalid_client_id","error_description":"client identifier invalid"}
Abhijit Jagtap
  • 2,740
  • 2
  • 29
  • 43
  • Possible duplicate of [Salesforce Authentication Failing](https://stackoverflow.com/questions/12794302/salesforce-authentication-failing) – Chui Tey Jun 23 '18 at 01:22

1 Answers1

1

That looks right. Try this with curl:

curl https://login.salesforce.com/services/oauth2/token \
  -d "grant_type=password" \
  -d "client_id=YOUR_CLIENT_ID" \
  -d "client_secret=YOUR_CLIENT_SECRET" \
  -d "username=YOUR_USERNAME" \
  -d "password=YOUR_PASSWORD"
James Ward
  • 29,283
  • 9
  • 49
  • 85
  • 3
    thanks for respoding, resolved my issue actually problem was my ip not white listed hence it gives me authentication error. and also i didnt mention my security token in body. – Abhijit Jagtap Aug 01 '16 at 15:36