All docs This doc
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

Let's see how you can get an access token from Salesforce to access the Salesforce API's.

  1. Create a developer account for Salesforce in
  2. Navigate to Setup ➤ Create ➤ Apps, and in the Connected Apps section, click New to create a new connected app.
  3. To create a new app, you have fill the basic information as follow and then click Enable OAuth Settings to open the API section. In Enable OAuth Settings, you have to add the scope and need to put the callback as follow and save the configurations.

  4. Once you save the configurations, you can see your Consumer Key and under API (Enable OAuth Settings).
  5. Then copy the following URL and paste it into a web browser URL bar and you have to replace the <your_client_id> and <your_redirect_uri> with the created app values.<your_client_id>&redirect_uri=<your_redirect_uri>
  6. Then you need to approve the application to access your salesforce account. On successful authorization, the user's browser will redirect back to the redirect URI (Call back URL) at the client application, with a URL of the form:
  7. From the above redirect URL,  extract the authorization code and send a direct POST request to the authorization server with the following request with the relevant values of your created app.<your_client_id>&client_secret=<your_client_secret>&redirect_uri=<your_redirect_uri>&format=json

    In above you can set format as urlencoded, json or xml to get the response with the specified format.

  8. From the above response, you can get the accessToken to access the salesforce organization via the created app and refreshToken to refresh the accessToken when it will be expired.

  • No labels