Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Salesforce by (11.9k points)

I am trying to get the Session ID for my salesforce partial box.

My Code:

curl https://test.salesforce.com/services/oauth2/token -d "grant_type=password" -d "client_id=definitely the correct client id" -d "client_secret=definitely the correct client secret" -d "[email protected]" -d "password=passandsecuritytoken"

What else I did:

  • Grant full access in my connected app settings
  • Set Ip restrictions to loose IP restrictions
  • "All users can authorize themselves"
  • Double checked pass, client id, client secret, username

I am still getting the error {"error":"invalid_grant","error_description":"authentication failure"}.

I searched through the SF forums and StackOverflow questions, but I couldn't find any solution for this. Does anyone know, what else could be the problem here?

1 Answer

0 votes
by (32.1k points)

The following steps might help you in figure outing the solution for this:

Manage Apps > Connected Apps > Name of your App

Set "IP Relaxation" to "Relax IP restrictions".

Second, in my curl command which looked a lot like yours I left out the security token, so the password field was just the password.

I don't really know if I've solved my problem but I'm getting back an access token and not the "invalid_grant" error.

Looking for a comprehensive Salesforce Training? Enroll now!

Related questions

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...