gorgeous-motorcycle-71764
08/31/2025, 1:43 PMchilly-king-10285
08/31/2025, 1:43 PMchilly-king-10285
08/31/2025, 1:43 PMgorgeous-motorcycle-71764
09/01/2025, 12:41 PMchilly-king-10285
09/01/2025, 12:41 PMchilly-king-10285
09/01/2025, 12:41 PMory patch identity-config --project <project-id> --workspace <workspace-id> \ --add '/selfservice/flows/registration/after/hooks/0/hook="session"'
([Sign in after registration](https://www.ory.sh/docs/actions/session)). - If you need to target a specific method (e.g., code or oidc), patch the method-specific path. Example reported workaround for code: ory patch project <project-id> --replace '/services/identity/config/selfservice/flows/registration/after/code/hooks=[{"hook":"session"}]'
(From a past issue where Console didn’t expose this setting; use CLI if needed) ([Configure session after Registration via code in Console](https://github.com/ory/network/issues/340)). Option C — Self-hosted Kratos (kratos.yml) - Add the session hook in the registration after-hooks for the methods you use: selfservice: flows: registration: after: password: hooks: - hook: session oidc: hooks: - hook: session # For passwordless code, add: code: hooks: - hook: session
([Successful registration](https://www.ory.sh/docs/kratos/self-service/flows/user-registration#successful-registration), [Social sign-in config note](https://www.ory.sh/docs/self-hosted/kratos/configuration/oidc)). Operational tips - Session hook must run last because it modifies the HTTP response; no actions after it will execute. If mixing with webhooks/actions, ensure session is last in order ([Troubleshoot Ory Actions Webhook issues](https://www.ory.sh/docs/troubleshooting/troubleshoot-actions), [Sign in after registration](https://www.ory.sh/docs/actions/session)). - OIDC: Always enable session after OIDC registration to avoid forcing a separate login step ([Successful registration](https://www.ory.sh/docs/kratos/self-service/flows/user-registration#successful-registration)). - Browser flows: With session enabled, Kratos sets the session cookie on redirect; API/native clients receive session and session_token in the response ([Successful registration](https://www.ory.sh/docs/kratos/self-service/flows/user-registration#successful-registration), [Sign in after registration](https://www.ory.sh/docs/actions/session)).gorgeous-motorcycle-71764
09/01/2025, 12:42 PMchilly-king-10285
09/01/2025, 12:42 PMchilly-king-10285
09/01/2025, 12:43 PMyaml selfservice: flows: registration: after: password: hooks: - hook: session oidc: hooks: - hook: session code: hooks: - hook: session
- Rationale and examples for password/oidc (and why OIDC should always have session) are documented here (Successful registration). The OIDC config page also reminds to add the session hook under after/oidc/hooks to avoid requiring an extra login (Social sign-in). The session action modifies the HTTP response, so no hooks can run after it; place it last (Sign in after registration; Troubleshoot Actions). Citations: (["Successful registration"](https://www.ory.sh/docs/kratos/self-service/flows/user-registration#successful-registration), ["Social sign-in"](https://www.ory.sh/docs/self-hosted/kratos/configuration/oidc), ["Sign in after registration"](https://www.ory.sh/docs/actions/session), ["Troubleshoot Actions"](https://www.ory.sh/docs/troubleshooting/troubleshoot-actions)) 2) Restart Kratos - Apply the updated configuration by restarting your Kratos service so the hooks take effect (general config practice; the guide shows config changes are applied via service reload/restart) (["Configure User Interface" guide](https://www.ory.sh/docs/kratos/guides/deploy-kratos-example#configure-user-interface)). 3) Verify behavior - Browser flow: After successful registration, Kratos issues a 303 redirect and sets the session cookie (no separate login needed) when the session hook is enabled (Successful registration). - Native/API flow: The response includes session and session_token when session is enabled (Sign in after registration). Citations: (["Successful registration"](https://www.ory.sh/docs/kratos/self-service/flows/user-registration#successful-registration), ["Sign in after registration"](https://www.ory.sh/docs/actions/session)) Notes for Hydra integrations - No special Hydra change is required for this feature. Kratos creates the user session; your app can then continue into the Hydra login/consent as usual. If you are in a Hydra‑initiated login/registration, make sure your Kratos return URLs and Hydra URLs are set correctly so redirects flow back to Hydra after the session is created (see your existing Hydra/Kratos URL wiring). The core requirement here is the Kratos session hook (above). The registration “after/session” behavior is entirely on the Kratos side (Successful registration; Sign in after registration).gorgeous-motorcycle-71764
09/01/2025, 12:45 PMchilly-king-10285
09/01/2025, 12:45 PMchilly-king-10285
09/01/2025, 12:45 PM