i am trying to use this flow: Username-Password OAuth Authentication Flow

grant_type=password&client_id=3MVG9lKcPoNINVBIPJjdw1J9LLM82Hn FVVX19KY1uA5mu0QqEWhqKpoW3svG3XHrXDiCQjK1mdgAvhCscA9GE&client_secret= 1955279925675241571&username=testuser%40salesforce.com&password=mypassword123456

And it's work fine for salesforce users with salesforce licence. If i added my ip in white list on profile-based level, then i can ignore token.

Problem is: when i try same with community user, i get error:

grant type not supported

Question is: How can i send "user:password" to salesforce to determine what credentials is right? My thought: maybe i should connect via REST with my Salesforce credentials and after that use something like login(username, password) function (from login controller class)

Thank you for your help.


Ok, i found this usefull for my case: https://developer.salesforce.com/page/PHP_Toolkit_20.0_Login_Sample_(Partner)

    $authEndPoint = "https://login.salesforce.com/services/Soap/c/24.0/";   
        $USERNAME = $user_data['email'];
        $PASSWORD = $user_data['password'];
        $LOGINSCOPEHEADER = '00DcXXXXXXXX';  // your Salesforce.com Organization ID (Company information page)

        try {
          $mySforceConnection = new SforcePartnerClient();
          $mySoapClient = $mySforceConnection->createConnection(SOAP_CLIENT_BASEDIR.'/partner.wsdl.xml');
          $header = new LoginScopeHeader($LOGINSCOPEHEADER);
          $mylogin = $mySforceConnection->login($USERNAME, $PASSWORD);
          $user_info = $mySforceConnection->getUserInfo();
          $array = (array)$user_info;

          header('HTTP/1.0 200 OK'); 

          echo "logged"; 

        } catch (Exception $e) {
            header('HTTP/1.0 400 Bad Request'); 
            header('Content-Type: application/json');
          echo $e->faultstring;

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.