omniphx / forrest

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

Invalid grant_type and authentication failed #263

Open arjunnarale opened 4 years ago

arjunnarale commented 4 years ago
            Config::set('forrest.authentication', 'UserPassword');
            Config::set('forrest.credentials.consumerKey', $salesforceDetails->consumer_key);
            Config::set('forrest.credentials.consumerSecret', $salesforceDetails->consumer_secret);
            Config::set('forrest.credentials.callbackURI', $salesforceDetails->callback_url);
            Config::set('forrest.credentials.loginURL', $salesforceDetails->login_url);
            Config::set('forrest.credentials.username', $salesforceDetails->username);
            Config::set('forrest.credentials.password', $salesforceDetails->password);
            Config::set('forrest.credentials.grant_type', 'authorization_code');

I am already set the required parameter and set grant_type as authorization_code, Its throws error invalid grant_type. I have used another way using the Password instead of authorization_code. It throws 400 bad requests. Please advise as early as possible.

omniphx commented 4 years ago

When you configured your password did you append the security token to the end? If Login IP ranges are configured and you are in an acceptable range, you don't need the security token but you could also be getting this error due to IP ranges. You can check the user's login history and see more details there inside your salesforce org.

krlmrr commented 2 years ago

Try setting the IP setting to 'relaxed'