Skip to content

Not getting session info #286

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
3 of 5 tasks
nihalgurjar47 opened this issue Aug 9, 2023 · 1 comment
Open
3 of 5 tasks

Not getting session info #286

nihalgurjar47 opened this issue Aug 9, 2023 · 1 comment
Labels
bug Something is not working.

Comments

@nihalgurjar47
Copy link

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.

@nihalgurjar47 nihalgurjar47 added the bug Something is not working. label Aug 9, 2023
@vinckr
Copy link
Member

vinckr commented Aug 9, 2023

Hello @nihalgurjar47

Are you positive the cookie is passed in the request?
can you maybe try the request through curl and see if it succeeds?

See also this doc: https://www.ory.sh/docs/troubleshooting/csrf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is not working.
Projects
None yet
Development

No branches or pull requests

2 participants