2

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

https://theCompany.force.com/partner

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:

https://theCompany.force.com/partner/services/oauth2/authorize?response_type=code&client_id=<your_client_id>&redirect_uri=<your_redirect_uri>

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.

1 Answer 1

0

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:

try
{
    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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .