To login to my corporate client Salesforce GUI, I have to use the following link:


This link works and logs me in, if I want to log in manually. But when I try to integrate OAuth 2.0 with Salesforce into my application, I, logically, send a request to the following link:


This generates a valid link, and I am able to log in with it, but along with the response body I receive HTTP code 401. The workflow of my application is strictly set -- all 4xx and 5xx responses are failing. Therefore I cannot proceed with the response from Salesforce. Moreover, a valid auth link and 401 code looks like unexpected behaviour on Salesforce side.

And since I use GuzzleHttp library to process data, it throws ClientException...

​Is this a Salesforce bug? Or am I missing something in my implementation? Maybe, I should send an authorization request to some other link?

For instance, https://theCompany.force.com/services/oauth2/authorize?arguments (without /partner) does not work and sends 503 as expected.


As I said, I use GuzzleHttp library to process data, and it throws ClientException whenever I try to send a request to get partner login link.

Since I did not get any adequate response from Salesforce support or developer community,I decided to simply catch the exception:

    return $this->httpClient->get('https://theCompany.force.com/services/oauth2/authorize?' . $arguments)->getEffectiveUrl();
catch (GuzzleHttp\Exception\ClientException $e)
    return $e->getResponse()->getEffectiveUrl();

Once called $e->getResponse()->getEffectiveUrl(), it returns the valid login link.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.