Salesforce Rest Service Auth

I am wanting to open the full Salesforce rest library for things like a composite API to create tree structured data. Salesforce Developers as right now we can only do only a few supported things.

Is there an authentication flow that is recommended and a tutorial on how to set it up?

Hi @mslade,

To access the full Salesforce REST API, including the Composite API for creating tree-structured data, you need to set up authentication using OAuth 2.0. Here's a recommended authentication flow and steps to set it up in Retool:

  1. Create a Connected App in your Salesforce org:

    • Go to Setup > App Manager > New Connected App.
    • Provide a name and contact email for your Connected App.
    • Enable OAuth Settings and set the Callback URL to your Retool app URL.
    • Select the required OAuth scopes (e.g., "Access and manage your data (api)").
    • Save the Connected App.
  2. Obtain the Consumer Key and Consumer Secret:

    • In Salesforce, go to your Connected App's settings.
    • Copy the Consumer Key and Consumer Secret.
  3. Set up authentication in Retool:

  4. Authenticate and retrieve the access token:

    • In your Retool app, add a button or trigger to initiate the OAuth flow.
    • When triggered, Retool will redirect the user to the Salesforce login page for authentication.
    • After successful authentication, Salesforce will redirect back to your Retool app with the authorization code.
    • Retool will automatically exchange the authorization code for an access token.
  5. Use the access token to make API requests:

    • With the obtained access token, you can now make requests to the Salesforce REST API endpoints.
    • Set the "Authorization" header in your API requests to "Bearer <access_token>".
    • You can now access the full Salesforce REST API, including the Composite API, to create tree-structured data.

For a detailed tutorial on setting up Salesforce OAuth in Retool, you can refer to the Retool documentation or follow these steps:

  1. Go to the Retool documentation on Salesforce integration:
  2. Follow the step-by-step guide to create a Connected App in Salesforce and configure OAuth settings in Retool.
  3. Use the provided code snippets and examples to authenticate and make API requests to Salesforce.

By following these steps and the Retool documentation, you should be able to successfully set up authentication and access the full Salesforce REST API in your Retool app.

Hope this helps.



Thank you for the info. I was able to get that to work as long as I don't have Share Credentials between users. Since I want to use this in a workflow I need a shared credential as it won't allow user based Oauth in a workflow. As soon as I do that it does the Login, but it doesn't get any tokens. Any idea how to fix that?

Hey @mslade, thank you for your question. :slight_smile:

It sounds like you're on the right path. Could you please provide screenshots of the process you're following? When you said "As soon as I do that it does the Login, but it doesn't get any tokens", do you mean that the user is able to login but the workflow doesn't have access to the Auth Token?

Is share credentials between users is enabled on the resource configuration page? That could be your blocker here. :thinking: :crossed_fingers:

You may find these docs helpful!