1
votes

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"}
1

1 Answers

1
votes

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"