Theis Nielsen
10/24/2024, 8:35 PMbase_requester:
type: HttpRequester
url_base: <https://www.flow-ms.co.uk/api/v1/6524>
authenticator:
type: SessionTokenAuthenticator
login_requester:
type: HttpRequester
path: /
url_base: <https://www.flow-ms.co.uk/api/api-token-auth>
http_method: POST
authenticator:
type: NoAuth
request_headers: {}
request_body_json:
email: <mailto:bbg.apis@bedsandbars.com|bbg.apis@bedsandbars.com>
password: "{{ config['password'] }}"
request_parameters: {}
session_token_path:
- token
request_authentication:
type: ApiKey
inject_into:
type: RequestOption
field_name: Authorization
inject_into: header
in above is it possible to use
Authorization: Token {token}
instead of bearer?user
10/24/2024, 8:36 PMAuthorization: Token {token}
instead of bearer in the configuration you've provided. The ApiKeyAuthenticator
allows you to customize how the token is injected into the request header. To achieve this, you can modify the request_authentication
section of your SessionTokenAuthenticator
configuration. Here's how you can do it: yaml request_authentication: type: ApiKeyAuthenticator inject_into: type: RequestOption field_name: Authorization inject_into: header api_token: "Token {{ stream_slice.token }}"
In this configuration: 1. We're using ApiKeyAuthenticator
instead of the default BearerAuthenticator
. 2. We're specifying that we want to inject the token into the header. 3. We're setting the field_name
to "Authorization", which is the header we want to use. 4. In the api_token
field, we're prefixing the token with "Token " to achieve the desired format. This setup will result in the header being sent as Authorization: Token {token}
in your requests. It's worth noting that the exact syntax might vary slightly depending on your specific use case and how the session token is being accessed in your connector configuration. The {{ stream_slice.token }}
is an example and might need to be adjusted based on how your connector is structured. [Source: ApiKeyAuthenticator](https://docs.airbyte.com/connector-development/config-based/understanding-the-yaml-file/reference#/definitions/ApiKeyAuthenticator)Theis Nielsen
10/24/2024, 8:37 PMrequest_authentication:
type: ApiKeyAuthenticator
inject_into:
type: RequestOption
field_name: Authorization
inject_into: header
api_token: Token {{ stream_slice.token }}
Traceback (most recent call last):
File "/home/airbyte/.pyenv/versions/3.10.14/lib/python3.10/site-packages/airbyte_cdk/sources/declarative/manifest_declarative_source.py", line 192, in _validate_source
validate(self._source_config, declarative_component_schema)
File "/home/airbyte/.pyenv/versions/3.10.14/lib/python3.10/site-packages/jsonschema/validators.py", line 934, in validate
raise error
jsonschema.exceptions.ValidationError: 'ApiKeyAuthenticator' is not one of ['ApiKey']
Failed validating 'enum' in schema[0]['properties']['type']:
{'enum': ['ApiKey']}
On instance['type']:
'ApiKeyAuthenticator'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/airbyte/.pyenv/versions/3.10.14/lib/python3.10/site-packages/airbyte_cdk/connector_builder/main.py", line 82, in <module>
print(handle_request(sys.argv[1:]))
File "/home/airbyte/.pyenv/versions/3.10.14/lib/python3.10/site-packages/airbyte_cdk/connector_builder/main.py", line 76, in handle_request
source = create_source(config, limits)
File "/home/airbyte/.pyenv/versions/3.10.14/lib/python3.10/site-packages/airbyte_cdk/connector_builder/connector_builder_handler.py", line 45, in create_source
return ManifestDeclarativeSource(
File "/home/airbyte/.pyenv/versions/3.10.14/lib/python3.10/site-packages/airbyte_cdk/sources/declarative/manifest_declarative_source.py", line 68, in __init__
self._validate_source()
File "/home/airbyte/.pyenv/versions/3.10.14/lib/python3.10/site-packages/airbyte_cdk/sources/declarative/manifest_declarative_source.py", line 194, in _validate_source
raise ValidationError("Validation against json schema defined in declarative_component_schema.yaml schema failed") from e
jsonschema.exceptions.ValidationError: Validation against json schema defined in declarative_component_schema.yaml schema failed