[Declarative Source] SessionTokenProvider should support reading session token from text/plain auth response
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 58/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- python
- Domain
- authentication
Research direction
Start with airbyte_cdk/sources/declarative/auth/token_provider.py, especially SessionTokenProvider._refresh, and review the decoder definitions in airbyte_cdk/sources/declarative/models/declarative_component_schema.py. Verify how a text/plain login response should be handled without changing existing JSON/XML token extraction, and confirm that the session token is returned for the legacy response format.
Written by the indexing model from the issue text.
Description
Component
SessionTokenProvider
Relevant information
Currently, the SessionTokenProvider used in the SessionTokenAuthenticator only supports reading the session token from JSON/XML. This limits compatibility with older / legacy APIs which sometimes return the session token in the body as text/plain.
e.g. see slack thread in Community Slack channel.
Proposed solution
Provide a dummy TextDecoder class which can be used in token refresh method to conditional return response.text if decoder isinstance of TextDecoder.
class SessionTokenProvider(TokenProvider):
...
def _refresh(self) -> None:
response = self.login_requester.send_request(
log_formatter=lambda response: format_http_message(
response,
"Login request",
"Obtains session token",
None,
is_auxiliary=True,
type="AUTH",
),
)
if response is None:
raise ReadException("Failed to get session token, response got ignored by requester")
session_token = dpath.get(next(self.decoder.decode(response)), self.session_token_path) if not isinstance(self.decoder, TextDecoder) else response.text
if self.expiration_duration is not None:
self._next_expiration_time = ab_datetime_now() + self.expiration_duration
self._token = session_token # type: ignore # Returned decoded response will be Mapping and therefore session_token will be str or None
✅ Yes, I want to contribute
- Dominant language
- Python
- Stars
- 26
- Forks
- 53
- Avg merge
- 7d 2h
- Merged PRs (30d)
- 7
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from airbytehq/airbyte-python-cdk
-
airbyte-cdk connector test: --no-creds crashes when combined with --pytest-arg (tuple has no extend) Opencommunity
Difficulty 1/5 Under an hour Newbie friendliness 88/100
airbytehq/airbyte-python-cdk#1153 ·
-
community
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
airbytehq/airbyte-python-cdk#1147 ·
-
community
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
airbytehq/airbyte-python-cdk#1137 ·
-
community
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
airbytehq/airbyte-python-cdk#1127 · 1 comment ·
-
community
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
airbytehq/airbyte-python-cdk#1118 · 2 comments ·
All issues in airbytehq/airbyte-python-cdk
Similar issues
-
area: harness bug status: needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Human-Agent-Society/reef#625 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 1/5 Under an hour Newbie friendliness 80/100
learningequality/kolibri#15351 · 2 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Name consistency Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
eellak/triplestore#65 · 1 comment ·