Thursday, 5 May 2016

Access Token Generation | OAuth 2.0 | Connected App | Rest API Access Token

Problem:- How to Generate OAuth token to execute the Rest API.


Step 1:- Create the connected App. (This is one time activity only)

Setup->Create->App->


Then click on Connected App. Then Enter all required values and Save.




Step 2:-  Get Consumer key and Consumer Consumer Secret Values




Copy Consumer Key and Consumer Secret .

Step 3:- Open Mozilla and under that open Rest Client using Plugin.
( If not available then please install plugin from below link)

1) https://addons.mozilla.org/en-US/firefox/addon/restclient/
2) https://addons.mozilla.org/en-us/firefox/addon/rest-easy/




Step 4:- Generate URL

Use below link to Generate the Token for accessing SFDC 

https://ap1.salesforce.com/services/oauth2/token?grant_type=password&client_id=***Consumer Key_Here***&client_secret=***Consumer Secret_Here***&username=*********&password=*****password+securityToken******


Consumer key should be client id  and consumer Secrete should be client secret and Change the user id and passwords as per your id  


Step 5:- Give the link in the URL and it would generate the Access Token
 




The three primary endpoints used with OAuth 2.0 are:
  • Authorization—https://login.salesforce.com/services/oauth2/authorize
  • Token—https://login.salesforce.com/services/oauth2/token
  • Revoke—https://login.salesforce.com/services/oauth2/revoke
For a sandbox, use test.salesforce.com instead of login.salesforce.com.

Related Post
1) https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/quickstart_oauth.htm
2) https://developer.salesforce.com/page/Digging_Deeper_into_OAuth_2.0_on_Force.com
3) https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/intro_understanding_web_server_oauth_flow.htm


<<PREVIOUS       NEXT>>



Thanks,
Amit Chaudhary