i have a problem when trying to configure session ...
# ask-ai
l
i have a problem when trying to configure session token authentication
Copy code
Failed validating 'enum' in schema[0]['properties']['type']:
    {'enum': ['ApiKeyAuthenticator'], 'type': 'string'}
k
It looks like you're encountering an issue where the
TokenAuthenticator
is not recognized as a valid type in your schema. The error message indicates that the schema expects an
ApiKeyAuthenticator
, but you are using
TokenAuthenticator
. Based on the provided knowledge sources, it seems that the
SessionTokenAuthenticator
should be used for session token authentication. This authenticator can use either
SessionTokenRequestApiKeyAuthenticator
or
SessionTokenRequestBearerAuthenticator
for injecting the session token into requests. Here is an example configuration for `SessionTokenAuthenticator`:
Copy code
yaml {   "type": "SessionTokenAuthenticator",   "login_requester": {     "type": "HttpRequester",     "url_base": "<https://my_api.com>",     "path": "/login",     "authenticator": {       "type": "BasicHttpAuthenticator",       "username": "{{ config.username }}",       "password": "{{ config.password }}"     }   },   "session_token_path": [     "access_token"   ],   "expiration_duration": "PT1H",   "request_authentication": {     "type": "SessionTokenRequestApiKeyAuthenticator",     "inject_into": "header",     "field_name": "Authorization"   } }
In this example: -
login_requester
describes the request to obtain a session token. -
session_token_path
specifies the path in the response body to the session token. -
expiration_duration
sets the duration after which the session token expires. -
request_authentication
configures how the session token is injected into requests, using
SessionTokenRequestApiKeyAuthenticator
. Make sure you are using the correct type and structure as per the schema. For more details, you can refer to the [SessionTokenAuthenticator documentation](https://docs.airbyte.com/connector-development/config-based/understanding-the-yaml-file/reference#/definitions/SessionTokenAuthenticator). If you need to use a different method for injecting the session token, you can also use `SessionTokenRequestBearerAuthenticator`:
Copy code
yaml {   "type": "SessionTokenAuthenticator",   "login_requester": {     "type": "HttpRequester",     "url_base": "<https://my_api.com>",     "path": "/login",     "authenticator": {       "type": "BasicHttpAuthenticator",       "username": "{{ config.username }}",       "password": "{{ config.password }}"     }   },   "session_token_path": [     "access_token"   ],   "expiration_duration": "PT1H",   "request_authentication": {     "type": "SessionTokenRequestBearerAuthenticator"   } }
Ensure that your configuration matches the expected schema to avoid validation errors.
l
@kapa.ai type: SessionTokenAuthenticator login_requester: path: authenticate type: HttpRequester http_method: POST authenticator: type: NoAuth request_headers: content-type: application/json request_body_json: password: '{{ config[''password''] }}' username: '{{ config[''username''] }}' request_parameters: {} session_token_path: - token request_authentication: type: Bearer request_headers: {} request_body_json: {} request_parameters: {} this is the configuration I cant use SessionTokenAuthenticator?
k
Based on the information provided in the knowledge sources, you can indeed use the
SessionTokenAuthenticator
for your configuration. Here is a refined version of your configuration using the `SessionTokenAuthenticator`:
Copy code
yaml type: SessionTokenAuthenticator login_requester:   type: HttpRequester   url_base: <https://your_api_base_url.com>   path: authenticate   http_method: POST   authenticator:     type: NoAuth   request_headers:     content-type: application/json   request_body_json:     password: '{{ config['password'] }}'     username: '{{ config['username'] }}'   request_parameters: {} session_token_path:   - token expiration_duration: PT1H  # Example duration, adjust as needed request_authentication:   type: SessionTokenRequestBearerAuthenticator
### Explanation: 1.
login_requester
: This section configures how to make the request to obtain the session token. -
type
: Specifies the type of requester, which is
HttpRequester
. -
url_base
: The base URL of your API. -
path
: The path to the authentication endpoint. -
http_method
: The HTTP method to use, which is
POST
. -
authenticator
: Specifies the authentication method for the login request, which is
NoAuth
in this case. -
request_headers
: Headers to include in the request. -
request_body_json
: The body of the request, including the username and password. -
request_parameters
: Any additional parameters for the request. 2.
session_token_path
: Specifies the path in the response body to extract the session token. 3.
expiration_duration
: (Optional) Specifies the duration after which the session token expires. This is in ISO 8601 duration notation. 4.
request_authentication
: Specifies how to use the session token for subsequent requests. -
type
: The type of authenticator to use for requests, which is
SessionTokenRequestBearerAuthenticator
. For more details, you can refer to the [SessionTokenAuthenticator documentation](https://docs.airbyte.com/connector-development/config-based/understanding-the-yaml-file/reference#/definitions/SessionTokenAuthenticator). If you encounter any issues or need further customization, you might want to check the [advanced topics](https://docs.airbyte.com/connector-development/config-based/advanced-topics#parameters) for additional parameters and configurations.
j
@kapa.ai i cant see the session token option on my UI. in what version of Airbyte was it introduced
k
A message from kapa.ai
The
SessionTokenAuthenticator
was introduced as part of ongoing improvements to the Low-code CDK in alpha, as mentioned in the December 2022 release notes. Specifically, it was added in version v0.40.24 to v0.40.26 of Airbyte. Here is the relevant information from the release notes: - December 2022 Release Notes: - Added
SessionTokenAuthenticator
for authentication management. [#19716](https://github.com/airbytehq/airbyte/pull/19716) You can find more details in the [December 2022 release notes](https://docs.airbyte.com/release_notes/december_2022#improvements). If you are not seeing the
SessionTokenAuthenticator
option in your UI, ensure that you are using a version of Airbyte that is v0.40.24 or later. If you are on an older version, you may need to upgrade to access this feature.