bland-coat-72070
07/09/2025, 10:54 AMhydra perform
) I get sent to hydra/oauth2/auth
with a redirect to the self service login page. This then redirects me to kratos/self-service/login/browser
to create a new browser login flow. This then redirects me to self-service-ui/login?flow=flow-id
as expected. However now this is where it seems to go wrong. I again get redirected to kratos/self-service/login/browser
but this time without a login challenge and the loop continues until the browser stops it with ERR_TOO_MANY_REDIRECTS. This suggests a potential misconfiguration but I am unsure where to look.brief-egg-61061
07/09/2025, 10:54 AMbrief-egg-61061
07/09/2025, 10:54 AMui_url
for the login flow is set correctly in your Kratos configuration. If this is not set, Kratos will not know where to redirect the browser after initializing the login flow, which can cause redirect loops. The configuration should look like: yaml selfservice: flows: login: ui_url: <http://your-self-service-ui/login>
You can also set this via the SELFSERVICE_FLOWS_LOGIN_UI_URL
environment variable. If this is missing, you may end up at a fallback page or in a redirect loop [Docs: Kratos Fallback Login UI](https://www.ory.sh/docs/kratos/fallback/login). 2. Top-Level Domain Matching Ory requires that Kratos and your UI are hosted on the same top-level domain (e.g., <http://ory.example.com|ory.example.com>
and <http://app.example.com|app.example.com>
are fine, but <http://ory.example.com|ory.example.com>
and <http://example.com|example.com>
are not). If this is not the case, cookies (including session and CSRF tokens) will not be set correctly, leading to repeated flow initializations and redirect loops [Docs: Self-service flows](https://www.ory.sh/docs/kratos/self-service#browser-flows-for-server-side-apps-nodejs-php-java-). 3. Session Handling and Cookies If the browser is not accepting cookies, or if cookies are not being set due to domain mismatches or misconfigurations, Kratos will not recognize the session and will keep redirecting to create a new login flow. Make sure cookies are being set and sent with each request. 4. Return-to Parameter and Allowed Return URLs If you are using the return_to
parameter to redirect users after login, ensure that the domain is whitelisted in your Kratos configuration: yaml selfservice: allowed_return_urls: - <https://your-app.com/>
Otherwise, Kratos will ignore the return_to
parameter, which can also cause unexpected redirects [Docs: HTTP redirection configuration](https://www.ory.sh/docs/kratos/concepts/browser-redirect-flow-completion#redirection). 5. Hydra and Kratos Version Compatibility There have been issues reported when the configuration file version does not match the running Kratos version. Ensure your kratos.yml
matches the version of the Kratos binary you are running [Github Issue #4024](https://github.com/ory/kratos/issues/4024). 6. Check for Infinite Redirects Due to Missing Traits or Claims If you are using social sign-in or OIDC, and required identity traits are not mapped correctly, Kratos may redirect back to the registration or login page repeatedly. This is especially common if the identity schema is not satisfied by the data returned from the provider [Docs: Social sign-in troubleshooting](https://www.ory.sh/docs/troubleshooting/troubleshooting-social-sign-in#redirect-loops-after-registration). Summary of what to check: - Correct ui_url
in Kratos config for login flow. - Kratos, Hydra, and UI are on the same top-level domain. - Cookies are being set and sent. - allowed_return_urls
includes your app domain if using return_to
. - Configuration file version matches Kratos binary version. - All required identity traits are mapped if using OIDC/social sign-in. If after checking these points the issue persists, please provide more details about your configuration files and the exact URLs/domains in use, as the knowledge sources do not provide further specifics for your scenario.bland-coat-72070
07/09/2025, 11:01 AMbrief-egg-61061
07/09/2025, 11:01 AMbrief-egg-61061
07/09/2025, 11:01 AM