Authorization Configuration with OAuth 2.0

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

  1. Navigate to the MoEngage Dashboard and select Settings > Advanced settings > Authorization configuration. The Authorization configuration page is displayed.
  2. Click + Add OAuth config. The Setup Authorization page is displayed.
    setup OAuth.png

Adding an OAuth 2.0 configuration involves the following steps:

  1. OAuth details: Define the target audience for the campaign.
  2. 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:

  1. OAuth name: Enter a name for OAuth configuration. These settings would be available for selection during campaign creation.
  2. 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.
  3. 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.
  4. 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.
  5. API URL: Enter the API URL.
  6. 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
  7. URL parameters: Click + KV pair and enter the parameters for the API.
  8. Headers: Click + KV pair and enter the headers for the API.
  9. Body type: Configure the body for your requests using the following options:
    Form JSON Raw

    Create the body based on the form-encoded serialization for the webhook. Click + KV pair to add more form-encoded body.
    OAuth Form.png

  10. 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:

  1. OAuth delivery response
    Opaque JWT

    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. 

    Opaque.png

    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.

    Expiry.png

  2. 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.
  3. 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.
  4. 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

  1. 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.
    OAuth settings.png
    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.

  2. To edit an OAuth setting, click the ellipsis icon for the required OAuth setting and click Edit.
  3. 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.
    cannot delete.png

Was this article helpful?
0 out of 0 found this helpful

How can we improve this article?