Steps to Re-Authenticate a SalesForce instance with the API

As you may already know, you can re-authenticate Salesforce from Cloud Elements 2.0. However, you can also do this programmatically through API calls. Follow the steps below. 

  1. Make a GET request to /elements/sfdc/oauth/url.
    curl -X GET \	
  2. Get the token from the OAuth 2.0 flow.
  3. Get the current instance configuration.
    curl -X GET \<instance_id> \
    -H 'Authorization: User <Your_user_secret>, Organization <Your_organization_secret>' \
    -H 'accept: application/json'
  4. Get the body of the response from step 3.
  5. Replace the token from step 3 with the new token from 2.
  6. PUT{instanceId}?reAuthenticate=truewith the body being the body from the response in step 4.
  7. Make sure that in Step 6 you pass the correct authorization headers and OAuth token.