wonderful-salesclerk-46148
10/07/2025, 2:50 PMCustom domain: https://auth.mtpc.com and I have Custom UI Base URL: https://ui.mtpc.com. If I set in 'Custom UI URLs for Ory Kratos' the field Verification UI to just path /verification, it would redirect me to custom domain, not custom ui base url, like this: https://auth.mtpc.com/verification?flow=... , so I have to put the whole url to these fields, such as https://ui.mtpc.com/verification . Is this correct? The default states are /ui/verification, so I assumed it would take custom ui base url + path
Issue with recovery flow
When users enter the recovery code, the redirect fails and this is the error from the logs (I recucted the URLs for a bit better readability):
Error [ResponseError]: The Ory API endpoint returned a response code the SDK does not know how to handle. Please check the network tab for more information:
{
"error": {
"id": "session_aal2_required",
"code": 403,
"status": "Forbidden",
"reason": "An active session was found but it does not fulfill the requested Authenticator Assurance Level. Please verify yourself with a second factor to resolve this issue.",
"details": {
"redirect_browser_to": "...."
},
"message": "Session does not fulfill the requested Authenticator Assurance Level"
},
"redirect_browser_to": "...."
}wonderful-salesclerk-46148
10/08/2025, 2:57 PMblue-knife-89618
10/09/2025, 6:38 AMsession_aal2_required occurs when there is an active session, but it does not fulfill the required Authenticator Assurance Level 2 (AAL2), which means a second factor authentication is required.
This typically happens in flows that require multi-factor authentication (MFA), and the current session doesn't meet that requirement. The frontend/backend needs to handle this by redirecting the user to perform the second factor authentication or step-up authentication flow.wonderful-salesclerk-46148
10/10/2025, 3:26 PMblue-knife-89618
10/10/2025, 4:39 PMredirect_browser_to URL. This is not handled automatically by the SDK, but is expected to be implemented in your application logic.
So, the recommended approach is to catch the 403 error, check for session_aal2_required error and use the redirect_browser_to URL to send the user to the 2FA flow.
Let me know if this works for you.blue-knife-89618
10/10/2025, 6:04 PMwonderful-salesclerk-46148
10/13/2025, 8:22 AMblue-knife-89618
10/13/2025, 12:55 PMOrySelfServiceFlowCard component. The component automatically handles login form submissions and apply the appropriate behavior based on the response. So typically when AAL2 is required, the hook receives a 422 response from Kratos, extracts the redirect URL from the response body, and performs the redirection.
If you are using OrySelfServiceFlowCard component, and still getting this error, can you please some more context on the error that you are getting like logs, example snippet and/or HAR file?wonderful-salesclerk-46148
10/13/2025, 12:58 PMRecovery component from import { Recovery } from '@ory/elements-react/theme' where we pass flow from getRecoveryFlow functionblue-knife-89618
10/13/2025, 1:15 PMblue-knife-89618
10/13/2025, 1:25 PMwonderful-salesclerk-46148
10/13/2025, 1:26 PMwonderful-salesclerk-46148
10/13/2025, 1:30 PMwonderful-salesclerk-46148
10/13/2025, 1:40 PMreturn_to is correct here (I would assume this where it should take me, not to settings actually):
{
"active": "code",
"expires_at": {},
"id": "ebc908d9-3b12-4583-b5ef-fabb75b7f9c9",
"issued_at": {},
"request_url": "http://localhost:3000/self-service/recovery/browser?app=creator&return_to=https%3A%2F%2Fapp.metapic.dev",
"return_to": "https://app.metapic.dev",
"state": "sent_email",
"type": "browser",
"ui": {
"action": "http://localhost:3000/self-service/recovery?flow=ebc908d9-3b12-4583-b5ef-fabb75b7f9c9",
"messages": [
{
"id": 1060003,
"text": "An email containing a recovery code has been sent to the email address you provided. If you have not received an email, check the spelling of the address and make sure to use the address you registered with.",
"type": "info"
}
],
"method": "POST",
"nodes": [
{
"attributes": {
"disabled": false,
"name": "csrf_token",
"node_type": "input",
"required": true,
"type": "hidden",
"value": "Z+lXb/X/5S/mnp80HW/1+FC6MBRfrtzuTvb74Yqu1NB+ixsqe66Exulq2VjcK+DDnnhzOBlXOStN7baL+r2gXg=="
},
"group": "default",
"messages": [],
"meta": {},
"type": "input"
},
{
"attributes": {
"disabled": false,
"maxlength": 6,
"name": "code",
"node_type": "input",
"pattern": "[0-9]+",
"required": true,
"type": "text"
},
"group": "code",
"messages": [],
"meta": {
"label": {
"id": 1070010,
"text": "Recovery code",
"type": "info"
}
},
"type": "input"
},
{
"attributes": {
"disabled": false,
"name": "method",
"node_type": "input",
"type": "hidden",
"value": "code"
},
"group": "code",
"messages": [],
"meta": {},
"type": "input"
},
{
"attributes": {
"disabled": false,
"name": "method",
"node_type": "input",
"type": "submit",
"value": "code"
},
"group": "code",
"messages": [],
"meta": {
"label": {
"id": 1070009,
"text": "Continue",
"type": "info"
}
},
"type": "input"
},
{
"attributes": {
"disabled": false,
"name": "email",
"node_type": "input",
"type": "submit",
"value": "[email protected]"
},
"group": "code",
"messages": [],
"meta": {
"label": {
"id": 1070008,
"text": "Resend code",
"type": "info"
}
},
"type": "input"
}
]
}
}blue-knife-89618
10/13/2025, 2:01 PMwonderful-salesclerk-46148
10/20/2025, 8:02 AMretunr_to?blue-knife-89618
10/20/2025, 4:33 PMwonderful-salesclerk-46148
10/21/2025, 7:57 AMmagnificent-energy-493
wonderful-salesclerk-46148
10/22/2025, 9:47 AMwonderful-salesclerk-46148
10/27/2025, 8:35 PMreturn_to url passed to the flow (therefore we have the bug with the settings page, as it redirects users to settings instead of return_to)