Creating a Custom OAuth App
Create an App
You can follow the procedure below to register an app and obtain the OAuth client credentials, the Client Id and Client Secret:
- Log in to your Salesforce Marketing Cloud Go to Marketing Cloud | Administration | Installed Packages.
- Click New.
- Give the package a name and description.
- Save the package. Once the package is saved, you see important details about the package. See Installed Packages Definitions for more information about each field. You see the Package ID, JWT Signing Secret, and Source Account only for packages created in your account.
- Under Components, click Add Component.
- Select API Integration.
- You must select Server-to-Server or Web App as integration type if the package supports enhanced functionality.
- Assign the appropriate scope for your integration.
- Perform server-to-server requests... is automatically selected for all API Integrations.
- Select Perform requests on behalf of the user... if this package contains a Marketing Cloud app.
- Select the Marketing Cloud scope for your API calls. Assign only the scope your package needs.
- Save the component.
- Under the component details, you can find the Client ID and Client Secret.
Authenticate to Salesforce Marketing Cloud
After setting the following connection properties, you are ready to connect:
- InitiateOAuth: Set this to GETANDREFRESH. You can use InitiateOAuth to avoid repeating the OAuth exchange and manually setting the OAuthAccessToken connection property.
- OAuthClientId: Set this to the Client ID in your app settings.
- OAuthClientSecret: Set this to the Client Secret in your app settings.
- AccountId: Set this to the specific MID of the target business unit. This is not available for legacy packages.
- CallbackURL: Set this to the URL in your app settings. Note: The default value is https://127.0.0.1:33333.
- Exchanges the OAuthClientId and OAuthClientSecret for the OAuthAccessToken.
- Refreshes the access token when it expires.
- Saves OAuth values in OAuthSettingsLocation to be persisted across connections.