<@U04UQ68083H> is there any way that I can get the...
# ory-copilot
w
@chilly-king-10285 is there any way that I can get the current session id for an identity by using a valid oauth2 access token?
b
A message from kapa.ai
Based on the provided knowledge sources, there is no direct way to retrieve the current session ID for an identity using only a valid OAuth2 access token. - The
/sessions/whoami
endpoint allows you to retrieve the current session details, but it requires either an Ory Session Cookie or an Ory Session Token, not an OAuth2 access token. The documentation and SDK examples consistently show the use of session tokens or cookies for session lookups, not OAuth2 access tokens [Check session status](https://www.ory.sh/docs/identities/sign-in/check-session-token-cookie-api) [Using Ory Session Token](https://www.ory.sh/docs/kratos/session-management/overview#using-ory-session-token). - The administrative API to get session details (
getSession
) requires an Ory access token with administrative privileges, not an OAuth2 access token issued to a user [Getting session details](https://www.ory.sh/docs/kratos/session-management/list-revoke-get-sessions#getting-session-details). - OAuth2 access tokens are typically used to access protected resources or fetch user profile information from the userinfo endpoint, but not for session management or session ID retrieval [Fetch user profile](https://www.ory.sh/docs/polis/guides/npm-library#fetch-user-profile). In summary, the knowledge sources do not describe a method to obtain the current session ID for an identity using only a valid OAuth2 access token. Session management endpoints require session tokens, cookies, or administrative access tokens.