When Salesforce component is deployed into a dedicated tenant it can not use the OAuth App specifically created for our main app.elastic.io tenant. For this purposes a different OAuth App needs to be created.
Salesforce documentation page gives all specific details and explanation on how to create any app. We will go through the necessary steps to show where to locate those setup options.
In this guide:
Step-by-step creation of OAuth App
To start you need to navigate to the Setup section. Please log-in to your account and select the menu like this:
Next on left-side menu select the App Setup > Create menu which will open, you should select the App submenu:
After selecting the App, you will navigate to the App setup page where the particular section of interest is the Connected Apps section which looks like this:
Please select New as it is indicated. It will open a new page which should look like this:
Please fill-in the required details for Connected App Name, API Name and Contact Email and also select the check-box called Enable OAuth Settings at API (Enable OAuth Settings) section. After enabling this check-box it will extend into this particular setup:
Please pay attention to input the correct URL as it is explained in OAuth Callback Redirect URL guide.
The Salesforce documentation explains API (Enable OAuth Settings) part requirements. In particular, a special care must be taken to select at least these two settings:
Full access (full) - which allows access to all data accessible by the logged-in user, and encompasses all other scopes. This option, however, doesn’t return a
refresh token. For that purposes you need to explicitly request the
refresh_tokenscope to get one.
Perform requests on your behalf at any time (refresh_token, offline_access) -
This option would allows a
refresh tokento be returned if you are eligible to receive one. This lets the app interact with the user’s data while the user is offline. The refresh_token scope is synonymous with offline_access.
- Full access (full) - which allows access to all data accessible by the logged-in user, and encompasses all other scopes. This option, however, doesn’t return a
Please press save to create your OAuth App.
What comes after creating the OAuth App?
After creating the OAuth App Salesforce would show you a screen containing all the necessary details of your newly created OAuth App:
From this setup you would need to copy the Consumer Key and the Consumer Secret for use in your custom installation of Salesforce component.
These two keys would need to be defined as Environment Variables for your customly deployed component.
Here is where those two keys fit into the picture. After the deployment, your repository would normally look like this:
Follow You can configure environment variables here link to configure variables for this specific component:
You would need to create two variables here:
SALESFORCE_KEY= your OAuth client key, meaning the Consumer Key.
SALESFORCE_SECRET- your OAUth client secret, meaning the Consumer Secret.
More information is provide in How to define env vars for components documentation.