Setting Up Modern OAuth Connections for Salesforce

29 October 2024
KingswaySoft Team

OAuth is a modern application authentication and authorization infrastructure that provides secure access to your application data. This is achieved through various mechanisms, one of which involves generating an access token. The token-based authentication is more secure than sharing user credentials directly with an application. A compromised token can be revoked at any time, and a new one can be created. Users can each have their own token with different access levels for each user. Another major benefit from an administration perspective is that, instead of keeping track of credentials, you can send the token file directly while providing the token password through a separate secure communication if needed.

Setting up an OAuth connection can be an involved process, as there are numerous steps that can be slightly confusing if you have not worked with the concept before.

This blog post will walk you through the process of creating a Salesforce app for OAuth, obtaining any necessary information, and setting up a Salesforce Connection Manager to connect to your Salesforce application for integration purposes.

Creating Salesforce App

  1. Log in to your Salesforce account and search for your App Manager in the Quick Find Box.

    Salesforce App Manager

  2. In the App Manager, click on the “New Connected App” button.

    New Connected App

  3. Give your app a name and a contact email. The name will be displayed in the App Manager. Please ensure that the name is unique within your organization.

    App Setup

  4. Next, under the API Tab, check the Enable OAuth Settings. Make sure that you enter a callback URL. The callback URL is the same as the OAuth redirect URI. The callback URL is the URL to which the user is redirected after successful authorization. You can provide any valid HTTPS URL; however, ensure it is a URL without redirects.

    OAuth Settings

  5. After this, you need to select the OAuth scopes to apply for the app. You can do this by selecting the available OAuth scopes and adding them to the right side. Make sure you are adding the appropriate OAuth scopes, as the OAuth scopes define the permissions that are granted for the app. In this example, we have given “Full access” and "Perform requests on your behalf at any time" scopes. The "Perform requests on your behalf at any time" scope is used to get a refresh token. The refresh token will help refresh your access automatically, so you don't have to re-authenticate every time.

  6. Lastly, click Save. You have successfully created your Salesforce app.

Getting Client ID and Client Secret

  1. To get your client credentials, you need to go back to your App Manager. You can then go to the App that you just created. Click on the drop-down menu and select " View".

    View App

  2. This will allow you to open the app and view all its settings and configurations.

    OAuth Information

    It will show the Scopes that you have given the app and the Callback URL.

  3. Next, press the Manage Consumer Details; it will take you to another page showing the Consumer Key and Secret. You may be required to validate your identity. Salesforce will send a verification code to your email.

Consumer Details

Configuring Salesforce Connection Manager In SSIS

After completing the steps above, you may now head to your SSIS development environment to create your Salesforce Connection.

Our Salesforce Connection Manager supports both SOAP and REST Service Endpoints to connect with the Salesforce API. However, in this instance, we will be using REST. You will then need to provide the Instance Type. There are three options available:

  • Production
  • Sandbox
  • Other: this Instance Type would be used when the Service URL we generate in the Service URL window does not fully match the instance you want to connect to. In this case, the field is unlocked for editing.

Connection Manager

Finally, we will set the authentication type to AuthorizationCode.

You will then click "Get New Token" and enter the details from the previous steps to authorize and generate the token.

Since we created a Salesforce App earlier in the blog post, we will use the option My Own App. The KingswaySoft App is a publicly shared app that we provide for testing purposes; however, it is not recommended for production use.

Generate Token

  • Client ID: You can find the client ID in step 9 as the Consumer Key.
  • Client Secret: You can find the Client Secret in step 9 as the Consumer Secret.
  • Redirect URl: The URI was provided in step 4 as the Callback URL.

Please note that your Salesforce Administrator has enabled the Require Proof Key for Code Exchange (PKCE) Extension on an Org-wide level, or you can select the Require Proof Key for Code Exchange (PKCE) extension when creating the Salesforce app.

After clicking OK, you will be prompted to log into your Salesforce account, which will then redirect you to your redirect URL. The URL will contain a code. You need to copy the entire URL and paste it into the component.

Redirect Code

Finally, you will be prompted to set a password for the token file before it is saved. After this, the process will be completed. You can test the connection using the "Test Connection" button to verify if you can access the instance. Press OK to save the configuration you have created.

Closing Notes

We hope this has been helpful. In this blog post, we have covered the setup for the app required in Salesforce, along with obtaining your client ID, client secret, and generating the token file in the Salesforce Connection Manager. We have also explained how OAuth works and the benefits of using it as an authentication method over legacy authentication. In this blog post, our focus was on the Authorization Code authentication type for OAuth; however, our component also supports the Certificate OAuth type. You can take a look at our help manual help manual for more information.

Archive

October 2024 1 September 2024 1 August 2024 2 July 2024 1 June 2024 1 May 2024 1 April 2024 2 March 2024 2 February 2024 2 January 2024 2 December 2023 1 November 2023 1 October 2023 2 August 2023 1 July 2023 2 June 2023 1 May 2023 2 April 2023 1 March 2023 1 February 2023 1 January 2023 2 December 2022 1 November 2022 2 October 2022 2 September 2022 2 August 2022 2 July 2022 3 June 2022 2 May 2022 2 April 2022 3 March 2022 2 February 2022 1 January 2022 2 December 2021 1 October 2021 1 September 2021 2 August 2021 2 July 2021 2 June 2021 1 May 2021 1 April 2021 2 March 2021 2 February 2021 2 January 2021 2 December 2020 2 November 2020 4 October 2020 1 September 2020 3 August 2020 2 July 2020 1 June 2020 2 May 2020 1 April 2020 1 March 2020 1 February 2020 1 January 2020 1 December 2019 1 November 2019 1 October 2019 1 May 2019 1 February 2019 1 December 2018 2 November 2018 1 October 2018 4 September 2018 1 August 2018 1 July 2018 1 June 2018 3 April 2018 3 March 2018 3 February 2018 3 January 2018 2 December 2017 1 April 2017 1 March 2017 7 December 2016 1 November 2016 2 October 2016 1 September 2016 4 August 2016 1 June 2016 1 May 2016 3 April 2016 1 August 2015 1 April 2015 10 August 2014 1 July 2014 1 June 2014 2 May 2014 2 February 2014 1 January 2014 2 October 2013 1 September 2013 2 August 2013 2 June 2013 5 May 2013 2 March 2013 1 February 2013 1 January 2013 1 December 2012 2 November 2012 2 September 2012 2 July 2012 1 May 2012 3 April 2012 2 March 2012 2 January 2012 1

Tags