Back

This article provides information on adding an authentication to an event or visitor function.

In this article:

Functions require authentication to access some service providers, such as Facebook or Google. You can add authentication to a function in the Advanced tab of the Tealium Functions code editor. When you add an authentication, an access token is returned, which the function then uses to make requests from the service. The token is typically a string of characters that is used to identify a user or an application. Tealium functions must provide an authentication token to make API calls to Facebook or Google. To get an authentication token, you need an account with the service provider.

The steps for adding an authentication vary depending on the authentication selected. The following sections provide instructions for adding each available authentication type.

Add Facebook Authentication

You must log in to Facebook before adding a Facebook authentication. To add Facebook authentication, use the following steps:

  1. After you create a function, click the Advanced tab.
  2. Log in to your Facebook Ad account. 
  3. Click Assign Authentications.
  4. Click +Add Authentication, then select Facebook Authentication, and click Continue.
  5. Enter a Name and click Connect to Facebook.
    An authentication token is returned in User Token.
  6. Click Add.

Add Google Authentication

To add Google authentication, use the following steps:

  1. After you create a function, click the Advanced tab.
  2. Click Assign Authentications.
  3. Click +Add Authentication, then select Google Authentication, and click Continue.
  4. Enter a Name, the Developer Token name, and click Connect to Google.
    An authentication token is returned in User Token.
  5. Click Add.

Add OAuth 2.0 Authentication

Before you add OAuth 2.0 authentication, open your OAuth API provider settings in a different browser tab or window and add a new application for your OAuth integration with Tealium Functions.

  1. After you create a function, click the Advanced tab.
  2. Click Assign Authentications.
  3. Click +Add Authentication, then select OAuth 2.0, and click Continue.
  4. Select the Grant Type.
  5. Enter a Name for the access token, and click Next.
    A unique access token name for the function is generated based on the specified Name.

The steps for Establish Connection vary for each grant type. The following sections describe these steps for each grant type.

Authorization Code Grant Type

To establish a connection using the authorization code grant type, use the following steps:

  1. Click Copy to copy the Tealium Redirect URL.
  2. Add the Tealium Redirect URL to the settings for your client application.
  3. In the Client Application Credentials section, enter the following.
    • Client ID for your application.  May be called Consumer Key or API Key.
    • Client Secret from your application. May be called Consumer Secret or API Secret.
    • Scope (optional) to limit access to your data.
  4. In the Endpoint Configuration section, enter the following
    • Authorization URL, which is the URL of the API endpoint used to request an authorization code.
    • Authorization URL Query Parameters
    • Access Token URL, which is the URL of the API endpoint used to request access and refresh tokens.
  5. Click Establish Connection.
    If the connection was established, a message similar to the following is displayed:
    ConnectionEstablishedMsg.png
    If the connection could not be established, the message includes information on the reason. Update your configuration to correct the problem and try again.
  6. Click Finish.

Client Credential Grant Type

To establish a connection using the client credential grant type, use the following steps:

  1. In the Client Application Credentials section, enter the following.
    • Client ID for your application. May be called Consumer Key or API Key.
    • Client Secret from your application. May be called Consumer Secret or API Secret.
    • Scope (optional) to limit access to your data.
  2. In the Endpoint Configuration section, enter the following:
    • Access Token URL, which is the URL of the API endpoint used to request access and refresh tokens.
    • Access Token URL Query Parameters
  3. Click Test Connection.
    If the connection was established, a message similar to the following is displayed:
    ConnectionEstablishedMsg.png
    If the connection could not be established, the message includes information on the reason. Update your configuration to correct the problem and try again.
  4. Click Finish.

User Password Grant Type 

To establish a connection using the user password grant type, use the following steps:

  1. In the Client Application Credentials section, enter the following.
    • Client ID for your application. May be called Consumer Key or API Key.
    • Client Secret from your application. May be called Consumer Secret or API Secret.
    • Scope (optional) to limit access to your data.
  2. In the Endpoint Configuration section, enter the following:
    • Access Token URL, which is the URL of the API endpoint used to request access and refresh tokens.
    • Access Token URL Query Parameters
  3. Click Test Connection.
    If the connection was established, a message similar to the following is displayed:
    ConnectionEstablishedMsg.png
    If the connection could not be established, the message includes information on the reason. Update your configuration to correct the problem and try again.
  4. Click Finish.

Add API Key Authentication

To add an API key authentication, use the following steps:

  1. After you create a function, click the Advanced tab.
  2. Click Assign Authentications.
  3. Click +Add Authentication, then select API Key, and click Continue.
  4. Enter a Name for the token, and click Next.
    A unique access token name for the function is generated based on the specified Name.
  5. Enter the API Key.
    After you Save and Publish, the API Key is obfuscated and no longer visible.
  6. [Optional} Enter a host name to whitelist.
  7. To add an additional Host Name to whitelist, click + Add Host Name, and enter the name.
  8. Click Add.
  9. Click Done.

Add UID 2.0 Authentication

 To add UID 2.0 authentication, use the following steps:

  1. After you create a function, click the Advanced tab.
  2. Click Assign Authentications.
  3. Click +Add Authentication, then select Unified ID 2.0 Authentication, and click Continue.
  4. Enter a Name for this authentication and click Add.
    The token for UID2.0 is returned in UID2.0_Tealium, which can now be used in your code.

Delete an Authentication

Authentications that are assigned to a function or to a connector cannot be deleted. To delete an authentication, use the following steps:

  1. On the Advanced tab, click Assign Authentications.
  2. In the menu for the authentication to be deleted, click Delete.
    If the authentication is assigned to a function or a connector, a message displays, listing the functions or connectors to which it is assigned. Click Close.
    FunctionsAuthDelete.png
  3. If the authentication is not assigned to a function or to a connector, a confirmation dialog displays. Click Delete.

Additional Information

Public