Try WSO2 Cloud for Free
Sign in

All docs This doc

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Create a developer account for Salesforce via https://developer.salesforce.com/signup.
  2. Navigate to Setup -> Create -> Apps and in the Connected Apps section, click New to create a new connected application.
    Image RemovedImage Added
  3. To create a new app, fill the basic information, click Enable OAuth Settings to open the API section, and add the scope and the callback. Once done, save the configurations. You can see some example values in the following screenshot:
    Image Removed Image Added 
  4. Note your Consumer Key and under API (Enable OAuth Settings).
    Image Removed Image Added
  5. Replace the placeholders (i.e., <your_client_id> and <your_redirect_uri>) of the following URL with the values that you created earlier and view the URL using a web browser.

    Code Block
    https://login.salesforce.com/services/oauth2/authorize?response_type=code&client_id=<your_client_id>&redirect_uri=<your_redirect_uri>
  6. Approve the application to access your salesforce account and note that the browser redirects you to the call-back URL (redirect URL):
    https://app.com/oauth_callback?code=aWe...c4w%3D%3D
  7. From the call-back URL, extract the authorization code.

  8. Send a direct POST request to the authorization server using the following request. Be sure to change the values here to the actual values that you got earlier.

    Code Block
    https://login.salesforce.com/services/oauth2/token?code=aWe...c4w==&grant_type=authorization_code&client_id=<your_client_id>&client_secret=<your_client_secret>&redirect_uri=<your_redirect_uri>&format=json
    Tip

    In the above request, you can set the format as urlencoded, json or xml to get the response in one of the three formats.

  9. From the response that you get, extract the accessToken to access Salesforce via the created app. You also get a refreshToken to renew the accessToken when it expires.