SalesForce OAuth failed with {"error_description": "Authentication failed", "error": "invalid_grant"} response

Unable to setup SalesForce OAuth for a week with the same error. I don't know anymore: (

What I've done:

Guys please tell me what am I doing wrong? When I use the Google PostMan plugin with all my credentials everything works fine, but when I make requests locally I get an error: {"error_description": "authentication error", "error": "invalid_grant"}

IP relaxation set to relax callback_uri IPs with HTTPS

Maybe my IP is blocked by SalesForce? I don't know, other than this :(

+3


source to share


1 answer


Step 1: Create an account. You can create a (free) developer account at developers.salesforce.com Step 2: Ignore all landing pages and start shit. Its an endless marketing cycle. Step 3: Click the "Settings" link

Step 4: On the lefthand toolbar under "New" click "Applications"

Step 5: In the "Connected Applications" section, click "Create"

Step 6: Fill out the form. The important fields are marked below (you can leave the rest blank)

Step 7: Keep in mind Salesforce has crappy availability.

Step 8: Click Continue. Finally, you have a key (client ID) and a secret (client secret).



Step 9: But wait! You haven't done it yet.

Make sure IP restrictions are disabled as well, and make sure Allowed Users is set to "All users can log in". If you're worried about disabling security, don't do it now, you just want it to work now so you can make API calls. Tighten the permissions once you have everything working, one at a time, so you can figure out which settings are giving you authentication errors.

Step 10: Celebrate! This curvilinear call should succeed: curl -v https://login.salesforce.com/services/oauth2/token -d "grant_type = password" -d "the client_id YOUR_CLIENT_ID_FROM_STEP_8 =" -d "client_secret YOUR_CLIENT_SECRET_FROM_STEP_8 =" -d " the username = user@wherever.com "-d" password=foo@bar.com "Notes: - You should not do password authorization if you are creating a multi-tenant application where users must authorize their own application. To do this, use the Oauth2 workflow.

Follow this tutorial. This will resolve your login requests.

http://www.calvinfroedge.com/salesforce-how-to-generate-api-credentials/

0


source







All Articles