ODBC Driver for Snapchat Ads

Build 22.0.8462

Headless Machines

Using OAuth on a Headless Machine

To create Snapchat Ads data sources on headless servers or other machines on which the driver cannot open a browser, you need to authenticate from another machine. Authentication is a two-step process, as described below.

  1. Instead of installing the driver on another machine, you can follow the steps described in this section to obtain the OAuthVerifier value. Or, you can install the driver on another machine and transfer the OAuth authentication values, after you authenticate through the usual browser-based flow, as described in "Transfer OAuth Settings" below.
  2. You can then configure the driver to automatically refresh the access token from the headless machine.

You can follow the headless OAuth authentication flow using the driver's embedded OAuth credentials or using the OAuth credentials for your custom OAuth app.

Note that the headless OAuth flow uses several undocumented connection properties; you can set these in the connection string as usual.

Using the Embedded OAuth Credentials

This section describes the process to use embedded OAuth credentials.

Obtain a Verifier Code

Complete the following steps to authenticate from another machine and obtain the OAuthVerifier connection property:

  1. Click the following link to open the Snapchat Ads OAuth endpoint in your browser.
  2. Log in and grant permissions to the driver. You are then redirected to the callback URL, which contains the verifier code.
  3. Save the value of the verifier code. You will set this in the OAuthVerifier connection property.

On the headless machine, set the following connection properties to obtain the OAuth authentication values:

  • OAuthVerifier: Set to the verifier code.
  • InitiateOAuth: Set to REFRESH.

After the OAuth settings file is generated, set the following properties to connect to data:

  • InitiateOAuth: Set to REFRESH.

Transfer OAuth Settings

Complete the following steps to install the driver on another machine, authenticate, and then transfer the resulting OAuth values.

On a second machine, install the driver and connect with the following properties set:

  • InitiateOAuth: Set to GETANDREFRESH.

Test the connection to authenticate in the browser. Once you have successfully tested the connection, copy the OAuth settings file to your headless machine.

On the headless machine, set the following connection properties to connect to data:

  • InitiateOAuth: Set to REFRESH.

Using the Credentials for a Custom OAuth App

This section describes how to use the credentials for a custom OAuth app.

Create a Custom OAuth App

Creating a custom OAuth app is optional in the headless OAuth flow; you can skip creating an app by connecting with the driver's embedded OAuth credentials. You might want to create a custom OAuth app to change the information displayed when users log into Snapchat Ads to grant permissions to the driver. Creating a Custom OAuth App for the procedure. You can then follow the procedures below to authenticate and connect to data.

Obtain a Verifier Code

Set the following properties on the headless machine:

  • InitiateOAuth: Set to OFF.
  • OAuthClientId: Set to the Client Id in your app settings.
  • OAuthClientSecret: Set to the Client Secret in your app settings.

Complete the following steps to authenticate from another machine and obtain the OAuthVerifier connection property:

  1. Call the GetOAuthAuthorizationURL stored procedure with the CallbackURL input parameter set to the exact Redirect URI you specified in your app settings.
  2. Open the returned URL in a browser. Log in and grant permissions to the driver. You are then redirected to the callback URL, which contains the verifier code.
  3. Save the value of the verifier code. You will set this in the OAuthVerifier connection property.

On the headless machine, set the following connection properties to obtain the OAuth authentication values:

  • OAuthClientId: Set to the consumer key in your app settings.
  • OAuthClientSecret: Set to the consumer secret in your app settings.
  • OAuthVerifier: Set to the verifier code.
  • InitiateOAuth: Set to REFRESH.

After the OAuth settings file is generated, set the following properties to connect to data:

  • OAuthClientId: Set to the consumer key in your app settings.
  • OAuthClientSecret: Set to the consumer secret in your app settings.
  • InitiateOAuth: Set to REFRESH.

Transfer OAuth Settings

Complete the following steps to install the driver on another machine, authenticate, and then transfer the resulting OAuth values.

On a second machine, install the driver and connect with the following properties set:

  • OAuthClientId: Set to the client Id assigned when you registered your app.
  • OAuthClientSecret: Set to the client secret assigned when you registered your app.
  • CallbackURL: Set to the Redirect URI you specified in your app settings.

Test the connection to authenticate. Once you have successfully tested the connection, copy the OAuth settings file to your headless machine. On the headless machine, set the following connection properties to connect to data:

  • InitiateOAuth: Set to REFRESH.
  • OAuthClientId: Set to the consumer key in your app settings.
  • OAuthClientSecret: Set to the consumer secret in your app settings.

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