Jonathan Sider
06/01/2024, 12:34 PMkapa.ai
06/01/2024, 12:34 PMjson { "url": "<https://mycompany.app/api/create_token>", "method": "POST", "body": { "username": "{{ config['username'] }}", "password": "{{ config['password'] }}" } }
2. Store the Token: Once you receive the token in the response, you can store it in a variable. For example, if the response is: json { "token": "82fd7b1a22b98f2ae46f6ede85382a2b" }
3. Use the Token in Subsequent API Calls: You can then use this token in the header of subsequent API requests. Here is an example of how to use Jinja to inject the token into the header: yaml headers: Authorization: "Bearer {{ token }}"
Here is a more concrete example based on the knowledge sources: yaml { "url": "<https://mycompany.app/api/>{{ token }}/adx-report", "method": "GET", "headers": { "Authorization": "Bearer {{ token }}" } }
In this example, {{ token }}
is the Jinja pattern used to reference the token received from the authorization step. For more details on how to configure the token and use it in headers, you can refer to the [Airbyte documentation on authentication](https://docs.airbyte.com/connector-development/cdk-python/http-streams#authentication). If you encounter any issues with undeclared variables in Jinja, ensure that the context in which the token is being used is correctly set up and that the token variable is properly declared and accessible. For further assistance, you can also check the [GitHub issue](https://github.com/airbytehq/airbyte/issues/37314) where a similar problem was discussed.