Skip to content
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

Check session status: documentation and code are not consistent in this repo. #1612

Open
3 of 5 tasks
meotimdihia opened this issue Jan 8, 2024 · 0 comments
Open
3 of 5 tasks
Labels
bug Something is not working.

Comments

@meotimdihia
Copy link

meotimdihia commented Jan 8, 2024

Preflight checklist

Ory Network Project

No response

Describe the bug

in the documentation, we need xSessionToken and cookie: https://www.ory.sh/docs/identities/sign-in/check-session-token-cookie-api :

  const authHeader = req.headers.authorization
  const hasAuthHeader = authHeader.startsWith("Bearer ")
  const sessionToken = hasAuthHeader
    ? authHeader.slice(7, authHeader.length)
    : null

  const session = await ory
    .toSession({
      cookie: req.cookies.join("; "),
      xSessionToken: sessionToken,
    })
    .catch((err) => {
      // Check the error to see if it's a 401 / 403 -> not logged in
    })

But in the code, we just need cookies:
https://github.com/ory/kratos-selfservice-ui-node/blob/master/src/pkg/middleware.ts#L72

 frontend
      .toSession({ cookie: req.header("cookie") })
      .then(addSessionToRequest(req))

I can't find any explanation about what xSessionToken is used for.

Reproducing the bug


Relevant log output

No response

Relevant configuration

No response

Version

@ory/client": "^1.4.2",

On which operating system are you observing this issue?

Linux

In which environment are you deploying?

Docker

Additional Context

No response

@meotimdihia meotimdihia added the bug Something is not working. label Jan 8, 2024
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

1 participant