SAP Cloud Platform Open Connectors

Steps to Re-Authenticate a SalesForce instance with the API

As you may already know, you can re-authenticate Salesforce from SAP Cloud Platform Open Connectors. 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 \	
    'https://api.openconnectors.us2.ext.hana.ondemand.com/elements/api-v2/elements/sfdc/oauth/url?apiKey=<your_api_key>&apiSecret=<your_api_secret>&callbackUrl=<your_callback_url>'
  2. Get the token from the OAuth 2.0 flow.
  3. Get the current instance configuration.
    curl -X GET \
    https://api.openconnectors.us2.ext.hana.ondemand.com/elements/api-v2/instances/<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 https://api.openconnectors.us2.ext.hana.ondemand.com/elements/api-v2/api-v2/instances/{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.