+ Start a Discussion
Travis Lee 6Travis Lee 6 

Question on POST request for integration

Hey Everyone, 
I'm a novice developer trying to set up an integration between the Salesforce REST API and our platform. Since we utilize OneLogin for SSO, this is the flow that I was using https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/intro_understanding_username_password_oauth_flow.htm . I've followed all the steps concerning appending the security token to the end of the password, relaxed IP restrictions on the connected app, and configured the permitted users to "admin approved users are pre-authorized" but I'm still receiving the following error:

"error": "invalid_grant",
"error_description": "authentication failure"
}
Which I believe refers to the credentials being incorrect from what I've googled thus far. But, I'm confident that the credentials are correct because I used them to successfully log in to the Apex dataloader. 


Here's a screenshot of the request I'm attemping with the error message (minus the user credentials): User-added image


Any help or advice would be much appreciated!
Best Answer chosen by Travis Lee 6
Daniel BallingerDaniel Ballinger
What type of Org does the user belong to? If it is a sandbox you will need to use https://test.salesforce.com instead of https://login.salesforce.com

Also, do you see anything in the LoginHistory in Salesforce?

All Answers

Daniel BallingerDaniel Ballinger
What type of Org does the user belong to? If it is a sandbox you will need to use https://test.salesforce.com instead of https://login.salesforce.com

Also, do you see anything in the LoginHistory in Salesforce?
This was selected as the best answer
Travis Lee 6Travis Lee 6
Thanks for the reply, Daniel! The user belongs to a Production org. When I look in the login history (great tip btw), it says the Status is "Failed: Not Approved for Access". Googling that led me to this solution https://help.salesforce.com/apex/HTViewSolution?id=000212208&language=en_US. After that, I was able to manage the profiles for the connected app and grant the proper access. Thank you so much for your help!