famous-jackal-2829
07/01/2025, 6:07 AMbrief-egg-61061
07/01/2025, 6:07 AMbrief-egg-61061
07/01/2025, 6:08 AMreturn_to
Query Parameter When initializing the login flow, append the ?return_to=<your-url>
parameter to the URL. For example: https://<ORY_PROJECT_URL>/self-service/login/browser?return_to=<https://yourapp.com/your-path>
After a successful login, Ory will redirect the user to the specified URL. Make sure that the domain in return_to
is allow-listed in your Ory configuration to prevent open redirect attacks. You can do this by adding the domain to selfservice.allowed_return_urls
in your configuration: yaml selfservice: allowed_return_urls: - <https://yourapp.com/>
[Advanced integration: redirects](https://www.ory.sh/docs/kratos/bring-your-own-ui/custom-ui-advanced-integration), [Redirection configuration](https://www.ory.sh/docs/kratos/concepts/browser-redirect-flow-completion#redirection) 2. Configure Default Redirect URLs in Ory You can set default redirect URLs in your Ory project's configuration. For example, to always redirect to a certain path after login: yaml selfservice: flows: login: after: default_browser_return_url: <https://yourapp.com/your-path>
This will redirect users to the specified path after a successful login if no return_to
parameter is provided. [Ory Concepts: Redirect flows](https://www.ory.sh/docs/concepts/redirects#redirect-flows) Note: - If you use the return_to
parameter, it takes precedence over the default redirect URL. - The return_to
parameter must be set each time you initialize a new flow; it does not persist automatically across flows. For more details and examples, see the official documentation on [advanced redirects](https://www.ory.sh/docs/kratos/bring-your-own-ui/custom-ui-advanced-integration) and [redirect configuration](https://www.ory.sh/docs/kratos/concepts/browser-redirect-flow-completion#redirection).famous-jackal-2829
07/01/2025, 6:09 AMbrief-egg-61061
07/01/2025, 6:09 AMbrief-egg-61061
07/01/2025, 6:09 AM<https://core.alpha.qaap.io/check-session>
because you have set: yaml selfservice: flows: login: after: default_browser_return_url: <https://core.alpha.qaap.io/check-session>
However, if the redirect is not happening as expected, here are the most common reasons based on the official documentation and known issues: 1. return_to
Parameter Supersedes Default If you initialize the login flow with a ?return_to=...
query parameter, that URL will take precedence over the configured default_browser_return_url
. Make sure your login flow is not being started with a different return_to
value, or that the value is correct and allow-listed in allowed_return_urls
[Advanced integration: redirects](https://www.ory.sh/docs/kratos/bring-your-own-ui/custom-ui-advanced-integration), [Redirection configuration](https://www.ory.sh/docs/kratos/concepts/browser-redirect-flow-completion#redirection). 2. Allow-Listed Return URLs The target URL must be included in selfservice.allowed_return_urls
. You have included <https://core.alpha.qaap.io/check-session>
, which is correct. 3. UI Implementation If you are using a custom UI, ensure that it does not override the redirect logic. For example, some UIs only respect the return_to
parameter if it is present in the URL, and may not use the value from the flow object itself. This was a known issue in some Ory reference UIs and has been discussed in the community [return_to not honoured when registering (Login flow)](https://github.com/ory/network/issues/119). 4. Browser vs. API Flow The redirect behavior described applies to browser flows (requests with Accept: text/html
). If you are using AJAX or API flows, the response will be JSON and you must handle the redirect in your frontend code [Successful login](https://www.ory.sh/docs/kratos/self-service/flows/user-login#successful-login). 5. Misconfiguration or Caching Double-check for typos, extra spaces, or incorrect indentation in your config. Also, ensure you have reloaded/restarted the Kratos service after making changes. 6. Hooks or Custom Logic If you have custom hooks or logic in your UI or proxy (e.g., Nginx), ensure they are not interfering with the redirect. Summary: If you are not using a return_to
parameter and your UI is not overriding the redirect, Kratos should redirect to <https://core.alpha.qaap.io/check-session>
after login, as per your configuration. If it does not, review your UI logic and ensure you are not initializing the flow with a different return_to
value. If you are using a custom UI, make sure it reads the return_to
value from the flow object, not just from the URL [return_to not honoured when registering (Login flow)](https://github.com/ory/network/issues/119). If you are still experiencing issues, please provide details about how you are initializing the login flow and handling the redirect in your UI.famous-jackal-2829
07/01/2025, 8:59 AMbrief-egg-61061
07/01/2025, 8:59 AMbrief-egg-61061
07/01/2025, 8:59 AMGET /self-service/settings/browser
You should call this endpoint on your Kratos public URL. For example, if your Kratos public base URL is <https://login.alpha.qaap.io>
, the full endpoint would be: <https://login.alpha.qaap.io/self-service/settings/browser>
When accessed in a browser, this endpoint will redirect the user to your configured settings UI with the flow ID as a query parameter. If called via AJAX with Accept: application/json
, it will return the flow object as JSON without a redirect [User and Profile Settings for Client-Side (AJAX) Browser Clients](https://www.ory.sh/docs/kratos/self-service/flows/user-settings#user-and-profile-settings-for-client-side-ajax-browser-clients), [createBrowserSettingsFlow](https://raw.githubusercontent.com/ory/kratos/master/spec/api.json).famous-jackal-2829
07/01/2025, 4:04 PMbrief-egg-61061
07/01/2025, 4:04 PMbrief-egg-61061
07/01/2025, 4:04 PM/oauth2/sessions/logout
This endpoint is used to initiate and complete user logout at the Ory OAuth2 & OpenID provider and supports both OpenID Connect front-channel and back-channel logout. In your Go code, you would typically make a GET request to this endpoint on your Hydra public URL. For example: https://<your-hydra-domain>/oauth2/sessions/logout
This endpoint does not require authentication and will handle the logout process, including any necessary redirects as per the OpenID Connect specification [Hydra API Reference - revokeOidcSession](https://raw.githubusercontent.com/ory/hydra/master/spec/api.json). If you need to implement a custom logout handler (for example, as part of a consent app), you may also interact with the admin endpoints for accepting or rejecting logout requests, but for a standard browser-initiated logout, /oauth2/sessions/logout
is the correct endpoint.