Dynamic Bearer Token In API Bridge

Do you deal with expiring bearer tokens in API Bridge, that require manual token generation and data source updates for retrieving data into Looker Studio? The Dynamic bearer token option simplifies this process. It automatically generates a new token through an API call you specify, and uses it to fetch the data for you. Let’s walk through an example to understand how this works:

Note: Currently, this option only supports endpoints that allow GET requests to refresh the token.

Example Scenario: Express Retail API Integration

We’ll illustrate using the Express Retail API to fetch customer-related data. This API requires an initial access token generated via an API key. Subsequent API calls for data retrieval need to use this newly generated access token. Let’s automate this by automatically generating the access token using the API key and using it in other API calls.

1. Setting up the Data Source

  • Login to your account at https://apps.gox.ai.
  • Choose the Looker Studio app in the Apps section, select your teams, and go to Connectors -> JSON API.
  • Click on +Add new to create a data source.
  • Fill in the data source details:
    • Base URL: https://api.retailexpress.com.au/v2.1
    • Authorization: Dynamic Bearer token
    • Token Authentication URL: /auth/token
      (Suffix URL of Retail Express API’s Authorization endpoint)
    • Access token name: access_token
      (Field name containing the new access token in the Authorization API’s response)
    • Headers:
    • x-api-key: API_KEY (Your API key)
  • Save the data source

2. Creating a Query Config

  • Select the Query Configs tab and click on +Add New.
  • Choose the newly created data source and click on Next.
  • Name your query and select the created data source.
  • Fill in the query config details:
    • Method: GET
    • URL Path/Suffix: /customers
      (This is the URL suffix path to retrieve customer data from Retail Express API)
    • JMES Path: data
      (Picks out necessary data from the API’s response. In this case, the value with the name”data”)

Now, Two Minute Reports will automatically use the specified Authorization endpoint from the data source to generate a new bearer token for refreshing your reports.

This method simplifies the process by automatically generating a bearer token using specified Authorization endpoint and removes the need of manual updates to the data source.

We hope this feature is beneficial. If you have any more questions or need help, don’t hesitate to reach out by creating a support ticket here.

Tags: ,

Was this helpful?