- Create a developer account for Salesforce via https://developer.salesforce.com/signup.
- Navigate to Setup -> Create -> Apps and in the Connected Apps section, click New to create a new connected application.
- 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:
- Note your Consumer Key and under API (Enable OAuth Settings).
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.
- Approve the application to access your salesforce account and note that the browser redirects you to the call-back URL (redirect URL):
From the call-back URL, extract the authorization code.
In the above request, you can set the format as urlencoded, json or xml to get the response in one of the three formats.
- 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.