Salesforce Sales Cloud - Steps to Re-Authenticate a SalesForce instance with the API

As you may already know, you can re-authenticate Salesforce from Sugar Integrate. 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. Navigate to this URL to get the code as you would for 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. Take the body of the response from step 3 and delete the oauth.user.token and oauth.user.refresh_token

5. In the same body add a "providerData" object that contains the code.

"providerData": {
       "code": "xxxxxxxxxxx"

6. Now use the following endpoint with the body from the response in step 4 and 5.


7. Make sure that in Step 6 you pass the correct authorization headers and OAuth token.