Wednesday, June 18, 2014

How to get OAuth / Access token from Salesforce

Ok so you are doing integration and need to get the oauth token. There are many ways we can get it but if you need you can brows from these klinks :

Server Side Auth
Username and Password Auth
Understanding Auth

But for now we can just use this:

Request:
https://login.salesforce.com/services/oauth2/token

grant_type:password
client_id:********************************************
client_secret:***************
username:<Username>
password:<Password><Sec Token>

client_id: Is the client id of the connected app.
client_secret: Is the secret of the connected app.

The responce will be some thing like this with the access token:

Responce:
{ "id": "https://login.salesforce.com/id/XXXXXXXXX/XXXXXXXXXXXX",
"issued_at": "1399267999911",
"token_type": "Bearer",
"instance_url": "https://ap1.salesforce.com",
"signature": "XXXXQWXXXX/xXXXXXMsN/CCCCyrHzI=",
"access_token": "0FFGGGFFFG!AQEAQNpfMEtD1nccdssafaFFGGYCFneh8HGo9MHV9Eowl5zoNcNUwhWMb6RpdQcTPFakqxQSQmD_1jIBB78mjK95" }

No comments:

Post a Comment