top of page

How to Generate an Access Token to Access Salesforce org

We will assist you with this post to obtain OAuth2 tokens from the Salesforce REST API as quickly as possible.

We attempt to make the learning process as simple as possible. 🙂

To start with, you must create an account in Salesforce. You can use your paid Salesforce account if you already have one. If not then, go to the Salesforce Developer Edition and establish a new dev account. Do not establish a free trial account since free trial accounts do not always allow you to enable the API in your Salesforce account. To generate tokens, you must first log in to your account and create a Connected App.

Create a Connected App

  • Log in as an administrator in Salesforce and Select Setup from the account's drop-down list (upper-right corner).

  • In the left-hand pane, Home>>Quick Find >> App Manager

  • Select the New Connected App option (in the upper right corner).

  • Fill the basic required fields

  • Navigate to API (Enable OAuth Settings) section and click the Enable OAuth Settings checkbox. Enter in the Callback URL area. Choose Access and manage your data (API), Perform requests on your behalf at any time (refresh token, offline access), and Will provide access to your data over the Web (web) in the Selected OAuth Scopes area then click Add.

  • To save the new Connected App, click on the Save button.

  • Go Back to the connected application list and click on manage from the dropdown, then

  • Click on the Edit button on the new page that appears. Select All users may self- authorize in the Permitted Users list under OAuth regulations, and then hit the Save button.

  • Again go back to the connected Apps list and click on the dropdown of the App that you just created and then hit on View option

  • Go with API (Enable OAuth Settings) and make a note of the Consumer Key and Consumer Secret, which will be needed for configuration.

Now, We will require Consumer Key, Consumer Secret, UserName (i.e. Email id), Password, and Security Token.

To obtain Security Token

  • First, you have to click on the profile icon (in the upper right corner)

  • Click on Settings >>My Personal Information (on left side ) >> Reset My Security Token >> Reset Security Token

  • You will receive a mail with UserName and Security token.

Note: In salesforce, if the User’s Profile is API enabled then a Security token is not needed.

Obtain Access Token using Postman

  • Requested URL POST : https://{{paste-your-domain }}/services/oauth2/token

  • In request

Paste your credentials which you was saved like

grant_type = password

client_id = 3MVG**********tIS2

client_secret = CB3A********16

username = <<your username >>

password = << your org password >> + << your security token>>

With the help of this blog, you will be able to successfully create a Connected Application and generate an access token for your Salesforce account.

Follow us for more such posts...


bottom of page