helpful-fish-56090
07/16/2025, 2:25 PMbrief-egg-61061
07/16/2025, 2:25 PMbrief-egg-61061
07/16/2025, 2:25 PMCookie
HTTP header, e.g., Cookie: ory_kratos_session=...
- Security: Includes browser-specific security features like httpOnly and SameSite attributes. - Example: curl -H "Cookie: ory_kratos_session=..." "https://$<http://PROJECT_SLUG.projects.oryapis.com/sessions/whoami|PROJECT_SLUG.projects.oryapis.com/sessions/whoami>"
[Check session status](https://www.ory.sh/docs/identities/sign-in/check-session-token-cookie-api) ### X-Session-Token (Session Token) - Type: Bearer Token (string) - Usage: Issued when a user authenticates via a native (non-browser) flow, such as mobile or desktop apps. - Intended for: Native applications or non-browser clients. - How it works: The session token must be explicitly included in the request, typically in the Authorization: Bearer
or X-Session-Token
HTTP header. - Header: - Authorization: Bearer <session-token>
- or X-Session-Token: <session-token>
- Security: Designed for environments where cookies are not practical or supported. - Example: curl -H "Authorization: Bearer {your-session-token}" "https://$<http://PROJECT_SLUG.projects.oryapis.com/sessions/whoami|PROJECT_SLUG.projects.oryapis.com/sessions/whoami>"
[Check session status](https://www.ory.sh/docs/identities/sign-in/check-session-token-cookie-api) --- Summary: - Use ory_kratos_session (cookie) for browser-based apps. - Use X-Session-Token (token) for native or non-browser apps. Ory's /sessions/whoami
endpoint accepts both, and will authenticate the user based on whichever is present in the request. This allows your API to support both browser and native clients seamlessly [toSession API reference](https://raw.githubusercontent.com/ory/kratos/master/spec/api.json), [Browser vs. native apps](https://www.ory.sh/docs/identities/native-browser).helpful-fish-56090
07/16/2025, 2:43 PMhelpful-fish-56090
07/16/2025, 2:50 PMbrief-egg-61061
07/16/2025, 2:50 PMbrief-egg-61061
07/16/2025, 2:50 PMhelpful-fish-56090
07/17/2025, 1:41 PMbrief-egg-61061
07/17/2025, 1:41 PMbrief-egg-61061
07/17/2025, 1:41 PM/self-service/login/api
) instead of the browser flow endpoints (e.g., /self-service/login/browser
). The browser flow is designed to work with cookies, while the native flow is designed to work with tokens. Summary: You cannot obtain an X-Session-Token during a browser flow login session. Use the native flow if you need a session token.helpful-fish-56090
07/17/2025, 1:44 PMbrief-egg-61061
07/17/2025, 1:45 PMbrief-egg-61061
07/17/2025, 1:45 PMhelpful-fish-56090
07/18/2025, 8:42 AMbrief-egg-61061
07/18/2025, 8:42 AMbrief-egg-61061
07/18/2025, 8:42 AM