TDV Adapter for Mailchimp

Build 22.0.8462

Creating a Custom OAuth App

There are two authentication methods available for connecting to MailChimp: You can use the APIKey or use OAuth.

Using the API Key to Connect to MailChimp

The APIKey grants full access to your MailChimp account. To obtain the APIKey, log into MailChimp and click Account -> Extras -> API Keys.

Using OAuth to Connect to MailChimp

OAuth requires the authenticating user to interact with MailChimp using the browser. The adapter facilitates this in various ways as described in the following sections.

Register Your Application

Follow the steps below to obtain the OAuth client credentials, the OAuthClientId and OAuthClientSecret:

  1. Log into your MailChimp account and click Account -> Extras -> API Keys -> Register and Manage Your Apps.
  2. Enter the information you want to be displayed to users when they are prompted to grant permissions to your application. This information includes your app name, company, and website.
  3. If you are making a desktop application, in the Redirect URI box enter http://127.0.0.1.

    If you are making a Web application, in the Redirect URI box enter a URL where you would like users to be redirected after they grant permissions to your application.

Authenticate to MailChimp from a Desktop Application

After setting the following connection properties, you are ready to connect:

  • OAuthClientId: Set this to the client Id in your app settings.
  • OAuthClientSecret: Set this to the client secret in your app settings.
  • CallbackURL: Set this to the redirect URI in your app settings.
  • InitiateOAuth: Set this to GETANDREFRESH. You can use InitiateOAuth to avoid repeating the OAuth exchange and manually setting the OAuthAccessToken connection property.
When you connect the adapter opens the OAuth endpoint in your default browser. Log in and grant permissions to the application. The adapter then completes the OAuth process:
  1. Extracts the access token from the callback URL and authenticates requests.
  2. Refreshes the access token when it expires.
  3. Saves OAuth values in OAuthSettingsLocation to be persisted across connections.

Authenticate to MailChimp from a Web Application

To obtain the access token, set the following connection properties:

  • OAuthClientId: Set this to the client Id in your app settings.
  • OAuthClientSecret: Set this to the client secret in your app settings.
  • CallbackURL: Set this to the redirect URI in your app settings.
When connecting via a Web application, or if the adapter is not authorized to open a browser window, you need to exchange temporary verification values for the access token:
  1. Call GetOAuthAuthorizationURL. The URL of the MailChimp OAuth endpoint is returned by the stored procedure.
  2. In your Web browser, log in and authorize the application. The MailChimp server then redirects you back via the callback URL.

    The verifier code is appended to the callback URL in a query string parameter named "code". Extract the verifier code from the callback URL.

  3. Call GetOAuthAccessToken.
To connect to data, set the OAuthAccessToken returned from the stored procedure.

Copyright (c) 2023 CData Software, Inc. - All rights reserved.
Build 22.0.8462