This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.
Creating a Connected Application using Salesforce and Obtaining User Credentials for the Created Application
Follow the steps below to create a connected application using Salesforce and obtain the consumer key as well as the consumer secret:
Go to https://developer.salesforce.com/signup, and create a Salesforce developer account.
Navigate to Setup -> Create -> Apps, and click New in the Connected Apps section to create a new connected application.
Specify a name for your connected application, your email address as well as any other basic information that is applicable to your application, and then select Enable OAuth Settings. This displays the API (Enable OAuth Settings) section.
Under the API (Enable OAuth Settings) section, specify a Callback URL. Depending on the OAuth flow you use, this is typically the URL that your browser is redirected to, after successful authentication. Since this URL is used in some OAuth flows to pass an access token, the URL must use secure HTTP or a custom URI scheme.
Select the required OAuth scopes from the Available OAuth Scopes list and click Add to include those as Selected OAuth Scopes. These OAuth scopes include permission given by the user running the connected application.
Once done, click Save. This saves the details of the connected application that you created, and you will see your Consumer Key and Consumer Secret under the API (Enable OAuth Settings) section.
Follow the steps below to obtain an access token and refresh token to access Salesforce via the connected application that you created:
In the following URL, first replace the
<your_client_id>place holder with the consumer key that you obtained. Next, replace the<your_redirect_uri>place holder with the value that you specified as the callback URL when creating the connected application, and then open the URL via a web browser.https://login.salesforce.com/services/oauth2/authorize?response_type=code&client_id=<your_client_id>&redirect_uri=<your_redirect_uri>Approve the application to access your Salesforce account. You will see that the browser redirects you to the callback URL that you specified when creating the connected application.
Extract the authorization code from the callback URL.
Send a direct POST request to the authorization server using the following request:
https://login.salesforce.com/services/oauth2/token?code=aWe...c4w==&grant_type=authorization_code&client_id=<your_client_id>&client_secret=<your_client_secret>&redirect_uri=<your_redirect_uri>&format=jsonFrom the response that you get, extract the access token to access Salesforce via the connected application that you created.