Ballerina Security

How to obtain Salesforce Developer OAuth2 Credentials

Create an SF account

How to get the access token



  1. Replace the <CONSUMER_KEY> and <CALLBACK_URL> of the following URL. Then copy and paste the URL into the browser.<CONSUMER_KEY>&redirect_uri=<CALLBACK_URL>
    • The browser will redirect to your <CALLBACK_URL> with the additional URL parameter called “code”. It will look like, <CALLBACK_URL>?code=<CODE>
  2. Build the following URL with the obtained <CODE>.<CODE>&grant_type=authorization_code&client_id=<CONSUMER_KEY>&client_secret=<CONSUMER_SECRET>&redirect_uri=<REDIRECT_URI>
  3. Send a POST request to the build URL. You can send the POST request with CURL.

     curl -X POST '<CODE>&grant_type=authorization_code&client_id=<CONSUMER_KEY>&client_secret=<CONSUMER_SECRET>&redirect_uri=<REDIRECT_URI>'
    • You will receive a JSON response with <ACCESS_TOKEN> and <REFRESH_TOKEN. It will look like follows:

            "access_token": "<ACCESS_TOKEN>",
            "refresh_token": "<REFRESH_TOKEN>",
            "signature": "<SIGNATURE>",
            "scope": "<SCOPE>",
            "instance_url": "",
            "id": "<ID>",
            "token_type": "Bearer",
            "issued_at": "<TIMESTAMP>"