gorgeous-motorcycle-71764
06/09/2025, 9:06 AMbrief-egg-61061
06/09/2025, 9:06 AMbrief-egg-61061
06/09/2025, 9:06 AMsid
claim) is propagated from Kratos to Hydra and then included in the ID token. Hydra supports including the sid
(session ID) claim in the ID token, which allows relying parties (RPs) to identify the user's session. This is particularly important for features like front-channel and back-channel logout, where the session ID is used to coordinate logout across services. The sid
claim is available if the integration between Kratos and Hydra is set up to propagate the session information correctly. From the Hydra OIDC discovery endpoint, you can see that Hydra supports back-channel and front-channel logout with session IDs: > Boolean value specifying whether the OP can pass a sid (session ID) Claim in the Logout Token to identify the RP session with the OP. If supported, the sid Claim is also included in ID Tokens issued by the OP [Hydra OIDC Discovery Reference](https://www.ory.sh/docs/hydra/reference/api)<source>https://www.ory.sh/docs/hydra/reference/api</source>. Additionally, a comment from a Hydra issue confirms that the ID token hint now includes the `sid`/session ID claim, which was previously missing and is necessary for session management and logout flows: > This can probably be implemented now because the ID token hint includes the sid / session id claim, which was missing before and iirc was the reason why we needed a session cookie to figure out which session to invalidate [Hydra Issue #3132](https://github.com/ory/hydra/issues/3132)<source>https://github.com/ory/hydra/issues/3132</source>. Summary: When Hydra issues an ID token after successful authentication via Kratos, the user's session ID (sid
) is included in the ID token if the integration is configured correctly. You can extract the session ID by decoding the ID token and reading the sid
claim. If you need to customize or ensure the presence of specific claims (including sid
), you can use Hydra's consent and token webhook mechanisms to control the claims included in the ID token as part of the OAuth2 flow [Hydra Token Webhook Guide](https://www.ory.sh/docs/hydra/guides/claims-at-refresh)<source>https://www.ory.sh/docs/hydra/guides/claims-at-refresh</source>. If you need more details on how to configure this propagation or how to extract the session ID in your specific setup, please provide more context or refer to the integration documentation for Kratos and Hydra.gorgeous-motorcycle-71764
06/09/2025, 9:11 AMbrief-egg-61061
06/09/2025, 9:11 AMbrief-egg-61061
06/09/2025, 9:11 AMsid
(session ID) claim in the ID token. This is confirmed by the OIDC discovery endpoint in Hydra, which documents the support for back-channel and front-channel logout and explicitly states: > Boolean value specifying whether the OP can pass a sid (session ID) Claim in the Logout Token to identify the RP session with the OP. If supported, the sid Claim is also included in ID Tokens issued by the OP. This feature is not limited to Ory Network and is available in self-hosted Hydra as well, provided your configuration and integration with the identity provider (such as Ory Kratos) propagate the session information correctly. The presence of the sid
claim is necessary for OIDC session management and logout flows, and Hydra's documentation and API reference confirm this support in the self-hosted deployment [Hydra OIDC Discovery Reference](https://www.ory.sh/docs/hydra/reference/api). If you need the sid
claim to be present, ensure your client and consent app are configured to support OIDC session management and that the session ID is available during the consent flow.gorgeous-motorcycle-71764
06/09/2025, 9:12 AMbrief-egg-61061
06/09/2025, 9:12 AMbrief-egg-61061
06/09/2025, 9:12 AMsid
(session ID) claim in the ID token, you need to ensure that your OAuth2/OIDC client and consent app are set up to support OIDC session management and that the session ID is available during the consent flow. According to the OIDC discovery endpoint in Hydra, the sid
claim is included in ID tokens if back-channel or front-channel logout is supported and configured. Specifically: > Boolean value specifying whether the OP can pass a sid (session ID) Claim in the Logout Token to identify the RP session with the OP. If supported, the sid Claim is also included in ID Tokens issued by the OP [Hydra OIDC Discovery Reference](https://www.ory.sh/docs/hydra/reference/api). However, the knowledge sources do not provide explicit step-by-step instructions or configuration flags to force the inclusion of the sid
claim. The inclusion of sid
is typically handled automatically by Hydra when session management features (such as front-channel or back-channel logout) are enabled and the session ID is available from the identity provider (e.g., Ory Kratos). Summary: - Hydra will include the sid
claim in the ID token if session management (front-channel or back-channel logout) is supported and configured. - Ensure your consent app and identity provider propagate the session ID to Hydra during the consent flow. - There is no explicit configuration flag documented in the provided sources to force the sid
claim; it is handled as part of the OIDC session management support. If you need more granular control over claims, you can use Hydra’s token webhook to customize the token payload, but the knowledge sources do not detail this specifically for the sid
claim [Hydra Token Webhook Guide](https://www.ory.sh/docs/hydra/guides/claims-at-refresh). If you need exact implementation steps, the knowledge sources do not contain enough information to provide them.gorgeous-motorcycle-71764
06/09/2025, 9:14 AMbrief-egg-61061
06/09/2025, 9:14 AMbrief-egg-61061
06/09/2025, 9:14 AMsid
(session ID) claim in the ID token does not change fundamentally—Hydra should still include the sid
claim if session management (front-channel or back-channel logout) is supported and the session information is available. However, the knowledge sources do not provide explicit documentation or configuration steps that guarantee the sid
claim will be present in the ID token specifically when consent is skipped. The documentation and related issues confirm that Hydra supports the sid
claim for session management and that it is included in the ID token when session management is enabled and the session ID is available from the identity provider (e.g., Ory Kratos) [Hydra OIDC Discovery Reference](https://www.ory.sh/docs/hydra/reference/api). There is no mention in the knowledge sources of the "skip consent" setting affecting the inclusion of the sid
claim. The inclusion of sid
appears to be tied to OIDC session management and not to the consent flow itself. Summary: - Skipping consent does not, according to the available documentation, prevent Hydra from including the sid
claim in the ID token, as long as session management is enabled and the session ID is available. - The knowledge sources do not provide explicit steps or guarantees for this scenario, so if you are not seeing the sid
claim, you may need to review your session management and identity provider integration. If you need a guarantee or a way to debug why sid
is missing, the knowledge sources do not contain enough information to provide a definitive answer for this specific scenario.gorgeous-motorcycle-71764
06/09/2025, 10:21 AMbrief-egg-61061
06/09/2025, 10:21 AMbrief-egg-61061
06/09/2025, 10:21 AMsid
(session ID) claim in Hydra's ID token, session management, and consent skipping: - OIDC Session Management and the sid
Claim: The Ory Hydra OIDC discovery endpoint documents that Hydra supports including the sid
claim in ID tokens when session management (front-channel or back-channel logout) is enabled. This is described as: > Boolean value specifying whether the OP can pass a sid (session ID) Claim in the Logout Token to identify the RP session with the OP. If supported, the sid Claim is also included in ID Tokens issued by the OP. This means that if your deployment supports OIDC session management, the sid
claim should be present in the ID token, regardless of whether consent is skipped [Hydra OIDC Discovery Reference](https://www.ory.sh/docs/hydra/reference/api). - Skipping Consent for Trusted Clients: The documentation explains how to configure OIDC clients to skip the consent screen and how this is managed in the consent app logic. It also notes that skipping consent is determined by the client configuration and the consent challenge object: > If the consent is skipped for the given OAuth2 client, challenge.client.skip_consent
is true
. The consent app can check this flag and immediately accept the consent request, but there is no mention that this affects the inclusion of the sid
claim in the ID token [Custom Login & Consent Flow: Consent](https://www.ory.sh/docs/oauth2-oidc/custom-login-consent/flow#consent). - OIDC Logout and Session ID: The documentation for OIDC logout describes how the sid
claim is used for front-channel and back-channel logout, and provides an example of the logout token containing the `sid`: {
"iss": "<https://server.example.com>",
"aud": "s6BhdRkqt3",
"iat": 1471566154,
"jti": "bWJq",
"sid": "08a5019c-17e1-4977-8f42-65a12843ea02",
"events": {
"<http://schemas.openid.net/event/backchannel-logout>": {}
}
}
This demonstrates the expected presence of the sid
claim in session management scenarios [OIDC Logout](https://www.ory.sh/docs/oauth2-oidc/oidc-logout). If you need more detailed implementation steps or troubleshooting for why the sid
claim might be missing in your specific setup, the knowledge sources above do not provide further details.gorgeous-motorcycle-71764
06/09/2025, 10:24 AMbrief-egg-61061
06/09/2025, 10:24 AMbrief-egg-61061
06/09/2025, 10:25 AM