2

I am developing an application in Angularjs and my requirements is to get login in my application through SalesForce, and access data of SalesForce.

I have created developer account in Salesforce and made application and have consumer key, consumer secret.

As of Now, I have understood things in this way,

  • Created a Developer SalesForce Account
  • Have Consumer Secret, and Consumer key

For the moment, I have button, and on click button, window is getting opened through this code..


    var authUrl = 'https://login.salesforce.com/services/oauth2/authorize?' + $.param({
                client_id : $scope.salesforce_clientId_web,
                redirect_uri : $scope.salesforce_client_redirecturi,
                response_type : $scope.salesforce_response_type
            });
    var authWindow = window.open(authUrl, '_blank', 'location=no');

  • First Time It will ask me for login in salesforce and it will redirect on redirect_uril which is given in my code..and I wll get code = "2323223".

    • I will fetch the code and will again do http post request using this code to get Request token, which helps me to get access of Salesforce account.

but, Now I have question Is there any api or javascript file which provide above steps like google has

<script src="scripts/google_client.js"></script>

It automatically pop-up window for google authentication. so, is there anything for salesforce.

Before I come on to any conclusion, and start implementing my code, I want to make sure. what is possible in salesforce.

Thanks

3

I am unaware of an officially provided solution like google_client.js, but it sounds like you have implemented the correct steps for a User-Agent OAuth2.0 flow. http://help.salesforce.com/HTViewHelpDoc?id=remoteaccess_oauth_user_agent_flow.htm&language=en_US

There are libraries that the community has provided, such as nforce (https://github.com/kevinohara80/nforce), a nodejs module that is a REST wrapper for Salesforce which includes authentication logic, and this blog post about using username/password OAuth flow in python http://www.wadewegner.com/2013/11/forcecom-token-requests-with-python/. There are other libraries and blogs out there if you are looking for a different options.

Detailed OAuth2.0 Force.com information: https://developer.salesforce.com/page/Digging_Deeper_into_OAuth_2.0_at_Salesforce.com.

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.