ory / ory/sdk

Unable to get session_token_exchange_code for native login flow with ory_kratos_client python SDK

Open
#296 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
PHP
Stars
178
Forks
96
Avg merge
6d 23h
Merged PRs (30d)
3

Description

Preflight checklist
Ory Network Project

No response

Describe the bug

With the ory_kratos_client python SDK, I am unable to create a native login flow which will return a session_token_exchange_code .

Reproducing the bug

Steps to reproduce:

  1. Creating a native login flow with the return_session_token_exchange_code=True:
    api_response = api_instance.create_native_login_flow(return_session_token_exchange_code=True)

  2. The response does not include the session_token_exchange_code field and the request_url present in the response is:
    'request_url': 'http://self_hosted_ory_kratos/self-service/login/api?return_session_token_exchange_code=True',

  3. From my observations and playing with the API directly, it seems that the issue comes from the uppercase T of True. Calling the api directly with an all lower cases true fixes the issue.
    'http://self_hosted_ory_kratos/self-service/login/api?return_session_token_exchange_code=true'
    I can observe a session_token_exchange_code field in the response.

Relevant log output

No response

Relevant configuration

No response

Version

Ory kratos V1.0.0 and ory-kratos-client 1.0.0

On which operating system are you observing this issue?

Linux

In which environment are you deploying?

Docker Compose

Additional Context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing create_native_login_flow in the generated Python client and inspect how the return_session_token_exchange_code query parameter is serialized. Reproduce the request with True and true, then verify that the generated URL uses lowercase true and the response includes session_token_exchange_code.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.