omniphx / forrest

A Laravel library for Salesforce
https://omniphx.github.io/forrest/
MIT License
259 stars 120 forks source link

Unable to authenticate #282

Closed shaunthornburgh closed 3 years ago

shaunthornburgh commented 3 years ago

Hi,

I have created a connected app on Salesforce. Originally I set the callback uri to:

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

However after reading through issues I found that this should be set to a local url for my development environment. I have updated this in my .env and in the connected app settings in salesforce.com. But I am still getting the following error:

Screenshot 2021-02-22 at 22 26 11

I am trying to authenticate with username and password and have add this to my .env:

SF_AUTH_METHOD=UserPassword

I have this in my web.php

Route::get('/authenticate', function()
{
    Forrest::authenticate();
    return Redirect::to('/');
});

I have cleared my cache, any suggestions on how I can get this resolved would be very much appreciated...

omniphx commented 3 years ago

Did you append a security token to the end of your password? That's required if you don't whitelist your IP address. Also, check your user in Salesforce and see if there are more details for the failed login attempt. Sometimes that can provide clues.

shaunthornburgh commented 3 years ago

Thank you @omniphx, the issue was in Salesforce, I changed 'permitted users' from 'Admin approved users are pre-authorized' to 'All users may self-authorize' and this fixed the issue for me.