FireDAC Components for Snowflake

Build 21.0.7958

Headless Machines

To create Snowflake data sources on headless servers or other machines on which the component cannot open a browser, you need to authenticate from another machine. Authentication is a two-step process.

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

You can follow the headless OAuth authentication flow using the OAuth credentials for your custom OAuth app.

Using the Credentials for a Custom OAuth App

Create a Custom OAuth App

See Creating a Custom OAuth App for a procedure. This section describes the procedure to authenticate and connect to data.

Obtain a Verifier Code

First, set the following properties on the headless machine:

  • InitiateOAuth: Set to OFF.
  • OAuthClientId: Set to the Client ID in your OAuth Integration settings.
  • OAuthClientSecret: Set to the Client Secret in your OAuth Integration settings settings.

Next, authenticate from another machine and obtain the OAuthVerifier connection property:

  1. Call the GetOAuthAuthorizationUrl stored procedure. Set the CallbackURL input to the Redirect URI you specified in your app settings.The stored procedure returns the URL to the OAuth endpoint and the PKCEVerifier.
  2. Open the returned URL in a browser. Log in and grant permissions to the component. You are then redirected to the callback URL, which contains the verifier code.
  3. Save the value of the Verifier and the value of the PKCEVerifier. You need to set the value of the Verifier in the OAuthVerifier connection property and set the value of the PKCEVerifier in the PKCEVerifier connection property.

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

  • OAuthVerifier: Set to the verifier code.
  • PKCEVerifier: Set to the PKCE verifier code.
  • OAuthSettingsLocation: Set to persist the encrypted OAuth authentication values to the specified file.
  • InitiateOAuth: Set to REFRESH.

Connect to Data

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

  • OAuthSettingsLocation: Set to the file containing the encrypted OAuth authentication values. Make sure this file gives read and write permissions to the provider to enable the automatic refreshing of the access token.
  • InitiateOAuth: Set to REFRESH.

Transfer OAuth Settings

To install the component on another machine, authenticate, and then transfer the resulting OAuth values:

  1. On a second machine, install the component and connect with the following properties set:
    • OAuthSettingsLocation: Set to a writable text file.
    • InitiateOAuth: Set to GETANDREFRESH.
    • OAuthClientId: Set to the Client ID in your app settings.
    • OAuthClientSecret: Set to the Client Secret in your app settings.
    • CallbackURL: Set to the Callback URL in your app settings.
  2. Test the connection to authenticate. The resulting authentication values are written, encrypted, to the path specified by OAuthSettingsLocation. 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.
    • OAuthSettingsLocation: Set to the path to your OAuth settings file. Make sure this file gives read and write permissions to the component to enable the automatic refreshing of the access token.

Copyright (c) 2021 CData Software, Inc. - All rights reserved.
Build 21.0.7958