ConnectorsSetup GuidesMarketing

Salesforce Connector

Salesforce is a cloud-based customer relationship management (CRM) service. Descope's Salesforce Connector allows you to execute SQL queries within your authentication flow, and retrieve information from a context key. This guide shows how to configure and use Descope's Salesforce Connector, as well as some example queries you may want to use in your flow.

Items to Note

  • The connector requires authentication using OAuth 2.0 Client Credentials grant type.
  • Ensure you have the necessary permissions to access the Salesforce API.

Example Queries for Authentication Flows

Here are some example queries that might be useful in an authentication flow:

1. Check User's Role

This query can be used to check if the user has a specific role within the organization. This can be helpful for role-based access control (RBAC).

q=SELECT+Id,UserRole.Name+FROM+User+WHERE+Username+=+'user@example.com'

2. Verify User's Account Status

This query checks if the user's account is active. This can prevent inactive users from logging in.

q=SELECT+Id,IsActive+FROM+User+WHERE+Username+=+'user@example.com'

3. Retrieve User's Profile Information

This query fetches detailed profile information about the user, which can be used for display purposes or further verification.

q=SELECT+Id,FirstName,LastName,Email+FROM+User+WHERE+Username+=+'user@example.com'

4. Check User's Last Login Time

This query retrieves the last login time of the user. It can be used to enforce security policies or provide additional context to the user.

q=SELECT+Id,LastLoginDate+FROM+User+WHERE+Username+=+'user@example.com'

5. Fetch User's Custom Attributes

If your Salesforce setup includes custom attributes, you can fetch them using a query like this. Custom attributes can be used for various conditional logic in your flow.

q=SELECT+Id,CustomAttribute__c+FROM+User+WHERE+Username+=+'user@example.com'

Now that you're more familiar with the kinds of SQL queries you can use with this connector, let's get into the setup process.

How to Configure


You can begin the configuration with two simple steps listed below.

  1. Generate Client ID and Client Secret from your Salesforce connected app. Ensure the app has the necessary permissions to access the API.
  2. Configure the connector with the required parameters, and save your configuration by clicking Create:

Setup connector

Required Parameters:

  • Connector name: Custom name for your connector.
  • Connector description: Describe what your connector is used for.
  • Base URL: The Salesforce API base URL, such as https://mydomainname.my.salesforce.com.
  • Client ID: The consumer key of the connected app.
  • Client Secret: The consumer secret of the connected app.
  • API Version: The version of the Salesforce API to use, such as v60.0.

How to Execute a Query

You can use the Salesforce connector to execute a generic SQL query. This can be incorporated into your authentication flow for various use cases.

To execute a query, follow these steps:

  1. In your flow, add the Salesforce / Query action block to the desired position in your flow:

Query step

  1. Configure the query action with the necessary SQL query. The query uses the /services/data/v60.0/query/ endpoint. You can utilize dynamic values as well in the Connector action. Here is an example format:
SELECT+Id,Account.Support_Tier__c+FROM+User+WHERE+Username+=+'{{user.email}}'

Query condition

And that's it! You should now be able to use Salesforce queries in your authentication flow, using Descope.

Was this helpful?

On this page