ory / ory/sdk

Not getting session info

Open
#286 1 comment 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

def user_kratos_session_info():
# Enter a context with an instance of the API client
kratos_url = "http://localhost:4433"
with ory_kratos_client.ApiClient(configuration=kratos_url) as api_client:
api_instance = frontend_api.FrontendApi(api_client)
cookie = "csrf_token_806060ca5bf70dff3caa0e5c860002aade9d470a5a4dce73bcfa7ba10778f481=564ihowvLVIqiCqjb1oH2U1O3y8vd1exNJdq0fEym+M="
try:
api_response = api_instance.to_session(cookie=f"ory_session={cookie}")
print("session_api", api_response)
except ory_kratos_client.ApiException as e:
print("Exception when calling FrontendApi->to_session: %s")

user_kratos_session_info()

I am calling this Python function to retrieve the session info, but I am encountering a 401 (unauthorized) error. I am passing the exact cookies that were generated at the same time.

Reproducing the bug

Kratos run through the docker-compose.

kratos_url = "http://localhost:4433"

Relevant log output

No response

Relevant configuration

No response

Version

ory-kratos-client==0.13.1

On which operating system are you observing this issue?

Linux

In which environment are you deploying?

Docker Compose

Additional Context

Once the user is logged in, we aim to retrieve session information for the active user. However, I am unable to obtain the session information using the Python SDK.

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 at the generated Python entry point FrontendApi.to_session and reproduce the 401 using ory-kratos-client==0.13.1 with the Docker Compose Kratos setup described. Compare the cookie argument with the client API contract and determine what behavior should be documented or corrected; the issue provides no logs, configuration, named files, or tests to define a narrower completion check.

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
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.