MoEngage allows you to configure OAuth 2.0 authentication services that fetch and refresh access tokens. As a marketer, while creating a custom connector campaign (in step 2 Content) or configuring a custom SMS connector, you can use OAuth 2.0 as authentication. For more information, refer to Create a Connector Campaign and Configure Custom Connector (Service Provider).
This article explains how to configure and manage OAuth 2.0 settings.
Add an OAuth 2.0 Configuration
- Navigate to the MoEngage Dashboard and select Settings > Advanced settings > Authorization configuration. The Authorization configuration page is displayed.
- Click + Add OAuth config. The Setup Authorization page is displayed.
Adding an OAuth 2.0 configuration involves the following steps:
- OAuth details: Define the target audience for the campaign.
- Response settings: Define the content of the connector campaign to be sent or the custom SMS connector.
Step 1: OAuth Details
On the OAuth details tab, enter the following details:
- OAuth name: Enter a name for OAuth configuration. These settings would be available for selection during campaign creation.
-
Grant type: Currently Client Credential grant type is supported. If you are using any other grant types, please raise a support ticket through MoEngage dashboard.
-
Token type: Select a token type. Supported values are:
- Opaque: Select this option if the token issuer uses Opaque tokens. Here the response from the issuer will contain the expiry time alongside the opaque access token.
- JWT: If you select this option, the access token and the expiry time is encoded in the response as JSON Web Token (JWT) in Step 2 Response settings. You must decode the response to get the expiry time.
- Under API details, provide the details required to fetch the access token. Please check the API documentation of the OAuth service you plan to implement.
- API URL: Enter the API URL.
-
Method: Select the API method. The following are the supported methods and available fields for each method:
Method Supported Fields GET - URL parameters
- Headers
POST - URL parameters
- Headers
- Body type
PUT - URL parameters
- Headers
- Body type
DELETE - URL parameters
- Headers
- Body type
- URL parameters: Click + KV pair and enter the parameters for the API.
- Headers: Click + KV pair and enter the headers for the API.
-
Body type: Configure the body for your requests using the following options:
Create the body based on the form-encoded serialization for the webhook. Click + KV pair to add more form-encoded body.
Create the body using the JSON format. Click + KV pair to add more JSON content.
Create the body using the raw text format.
- Click Send test & continue to test the configuration and move to the second step "Response settings".
info |
Information If you face error after you click Send test & continue, please check the API configuration with your OAuth service provider documentation. |
Step 2: Response Settings
On the Response settings tab, enter the following details:
- OAuth delivery response
If you have selected "Opaque" from the Token type drop-down list in Step 1 OAuth details, you will see only one OAuth delivery response field. The OAuth delivery response has a key with an expiry time, which is not encoded. You can also see when was the response received.
Select an expiry option from the Expiry drop-down list and select a value from the second drop-down list. The values on the Expiry drop-down list depend on the kind of response received.
If you have selected "JWT" from the Token type drop-down list in Step 1 OAuth details, you will see two OAuth delivery response fields.
In the first OAuth delivery response field, the response has a key with an expiry time, but the expiry time is encoded. You can also see when was the response received.
From the Access token drop-down list, select a key that has the expiry time and click Decode token type. After the token type is decoded, you will receive one more response in the second OAuth delivery response field.
Select an expiry option from the Expiry drop-down list and select a value from the second drop-down list. The values on the Expiry drop-down list depend on the kind of response received.
-
Preferred prefix: Select the preferred prefix of the OAuth setting.
Marketers can create custom prefixes in addition to the default options. These prefixes can be used when creating a custom connector or configuring a custom SMS connector, and can be overridden at a campaign level. - Preferred error codes: In the OAuth error code field, enter the preferred error code of the Oauth setting for an authorization failure because of an expired token. This error code can be used to reattempt the connector campaign or custom SMS connector.
- Click Save. Now this Oauth setting is active. You can now use this Oauth configuration while creating a custom connector campaign or configuring a custom SMS connector.
Manage OAuth Settings
- Navigate to the MoEngage Dashboard and select Settings > Advanced settings > Authorization configuration. The Authorization configuration page is displayed. You can see the existing OAuth settings configured.
info Information
A "Failed" OAuth setting means your OAuth configuration is unable to fetch a response. You must edit your OAuth configuration and send test again. Do not use failed OAuth settings while creating connector campaigns or configuring custom SMS connectors.
- To edit an OAuth setting, click the ellipsis icon for the required OAuth setting and click Edit.
- To delete an OAuth setting, click the ellipsis icon for the required OAuth setting and click Delete. If there are any campaigns associated with the OAuth setting, you will not be able to delete it. A warning is displayed with the list of associated campaigns.