Skip to main content
Alex Karshin ha fatto una domanda in #Integration
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.

Is this a Salesforce bug? Or am I missing something in my implementation? Maybe, I should send an authorization request to some other link?
1 risposta
  1. 26 ott 2016, 12:09
    Hi Alex,

    First and foremost sincerely regret delayed reply.

    As this post is answered as below in stack exchange community

     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.

    Kindly mark this post as solved so that it gets removed from the unanswered queue and becomes a proper solution which results in helping others who are really in need of it.

    Best Regards,

    Nagendra.P

     
0/9000