plain-lunch-50969
06/18/2024, 3:13 PMdefault_browser_return_url
is used when I register via oidc, but not via password. Why is that?chilly-king-10285
06/18/2024, 3:13 PMchilly-king-10285
06/18/2024, 3:13 PMdefault_browser_return_url
is a configuration key used in Ory's redirection flow. It specifies where the user should be redirected after a certain action, such as registration or login. In the context of registration, the default_browser_return_url
can be overridden for specific methods. For example, if you're using the password method for registration, you can specify a different default_browser_return_url
that will override the general one. This is done using the following configuration: yaml selfservice: flows: registration: after: # overrides url.default_browser_return_url default_browser_return_url: <https://this-is-overridden-by-password/> password: # overrides selfservice.registration.after.default_browser_return_url default_browser_return_url: <https://end-up-here-after-registration-with-password/>
(Source: [Post-registration redirection](https://www.ory.sh/docs/kratos/concepts/browser-redirect-flow-completion#post-registration-redirection)) Similarly, for the OIDC method, you can specify a different `default_browser_return_url`: yaml selfservice: flows: login: after: oidc: # redirect after successful login or registration with `OIDC` method default_browser_return_url: <https://end-up-here-after-login-with-oidc/>
(Source: [Login, registration, and settings](https://www.ory.sh/docs/concepts/redirects#login-registration-and-settings)) So, if you're not being redirected to the default_browser_return_url
after registration via password, it's likely because a different URL has been specified for the password method.plain-lunch-50969
06/18/2024, 3:14 PMchilly-king-10285
06/18/2024, 3:14 PMchilly-king-10285
06/18/2024, 3:15 PMdefault_browser_return_url
should be used. This is the default behavior as per the Ory documentation. Here is the relevant configuration: yaml selfservice: default_browser_return_url: <https://end-up-here-per-default/> flows: registration: after: # overrides url.default_browser_return_url default_browser_return_url: <https://this-is-overridden-by-password/> password: # overrides selfservice.registration.after.default_browser_return_url default_browser_return_url: <https://end-up-here-after-registration-with-password/>
(Source: [Post-registration redirection](https://www.ory.sh/docs/kratos/concepts/browser-redirect-flow-completion#post-registration-redirection)) If the default_browser_return_url
is not being used, it might be due to some other configuration issue or a bug. You might want to double-check your configuration and ensure that there are no errors. If the issue persists, consider reaching out to the Ory community or support for further assistance.plain-lunch-50969
06/18/2024, 3:16 PMregistration:
after:
default_browser_return_url: <https://blarg.net/userinfo>
hooks:
- config:
body: <base64://ZnVuY3Rpb24oY3R4KSB7CiAgInRleHQiOiBjdHguaWRlbnRpdHkudHJhaXRzLnV>zZXJuYW1lICsgIiBoYXMgY3JlYXRlZCBhIG5ldyBhY2NvdW50IHZpYSAiICsgc3RkLnNwbGl0KGN0eC5mbG93LnVpLmFjdGlvbiwgIi8iKVsyXSArICIuXG5AaGVyZSBwbGVhc2UgaW5pdCBhbmQgYWN0aXZhdGUgdGhlIGFjY291bnQuIgp9Cg==
method: POST
response:
ignore: true
url: <http://127.0.0.1/not-a-hook>
hook: web_hook
oidc:
hooks:
- hook: session
password:
hooks:
- hook: session
lifespan: 10m
ui_url: <https://blarg.net/registration>
chilly-king-10285
06/18/2024, 3:16 PMchilly-king-10285
06/18/2024, 3:17 PMdefault_browser_return_url
under the registration
flow. This URL should be used as the default redirection after registration unless overridden by a specific method like oidc
or password
. However, in your configuration, you have not specified a different default_browser_return_url
for the password
method, so the default one (`https://blarg.net/userinfo`) should be used. If this is not happening, it might be due to some other configuration issue or a bug. You might want to double-check your configuration and ensure that there are no errors. If the issue persists, consider reaching out to the Ory community or support for further assistance. Here is the relevant part of your configuration for reference: yaml registration: after: default_browser_return_url: <https://blarg.net/userinfo> hooks: - config: body: <base64 value> method: POST response: ignore: true url: <http://127.0.0.1/not-a-hook> hook: web_hook oidc: hooks: - hook: session password: hooks: - hook: session lifespan: 10m ui_url: <https://blarg.net/registration>
Please note that the actual base64 value in the body
field has been replaced with <base64 value>
for readability.plain-lunch-50969
06/18/2024, 3:18 PMchilly-king-10285
06/18/2024, 3:18 PMchilly-king-10285
06/18/2024, 3:19 PMplain-lunch-50969
06/18/2024, 3:23 PMregistration:
after:
default_browser_return_url: <https://blarg.net/userinfo>
oidc:
default_browser_return_url: <https://blarg.net/userinfo>
hooks:
- hook: session
password:
default_browser_return_url: <https://blarg.net/userinfo>
hooks:
- hook: session
lifespan: 10m
ui_url: <https://blarg.net/registration>
chilly-king-10285
06/18/2024, 3:23 PMchilly-king-10285
06/18/2024, 3:23 PMdefault_browser_return_url
for both the oidc
and password
methods under the registration
flow. This means that after registration via either of these methods, the user should be redirected to <https://blarg.net/userinfo>
. Here is your updated configuration for reference: yaml registration: after: default_browser_return_url: <https://blarg.net/userinfo> oidc: default_browser_return_url: <https://blarg.net/userinfo> hooks: - hook: session password: default_browser_return_url: <https://blarg.net/userinfo> hooks: - hook: session lifespan: 10m ui_url: <https://blarg.net/registration>
If you're still experiencing issues with redirection after registration, it might be due to some other configuration issue or a bug. If the issue persists, consider reaching out to the Ory community or support for further assistance.plain-lunch-50969
06/18/2024, 3:23 PMchilly-king-10285
06/18/2024, 3:23 PMchilly-king-10285
06/18/2024, 3:24 PMdefault_browser_return_url
for both oidc
and password
methods under the registration
flow. This means that after registration via either of these methods, the user should be redirected to <https://blarg.net/userinfo>
. Here is your configuration for reference: yaml registration: after: default_browser_return_url: <https://blarg.net/userinfo> oidc: default_browser_return_url: <https://blarg.net/userinfo> hooks: - hook: session password: default_browser_return_url: <https://blarg.net/userinfo> hooks: - hook: session lifespan: 10m ui_url: <https://blarg.net/registration>
If the OIDC registration is correctly redirecting to the return URL but the password registration is not, it might be due to a bug or some other configuration issue. Unfortunately, without more information, it's hard to determine the exact cause of the issue. You might want to double-check your configuration and ensure that there are no errors. If the issue persists, consider reaching out to the Ory community or support for further assistance.plain-lunch-50969
06/18/2024, 3:24 PMplain-lunch-50969
06/18/2024, 3:29 PMconst onRegistrationSubmit = (body: UpdateRegistrationFlowBody) => {
// something unexpected went wrong and the flow was not set
if (!flow) return history.push('/registration', { replace: true });
ory
.updateRegistrationFlow({
flow: flow.id,
updateRegistrationFlowBody: body,
})
.then(({ data }) => {
if ('continue_with' in data) {
for (const cw of data.continue_with ?? []) {
if (cw.action === 'show_verification_ui') {
const search = new URLSearchParams();
search.set('flow', cw.flow.id);
history.push(
{
pathname: '/verification',
search: search.toString(),
},
{ replace: true }
);
return;
}
}
}
// history.push('/userinfo');
})
.catch(sdkErrorHandler);
};
chilly-king-10285
06/18/2024, 3:29 PMchilly-king-10285
06/18/2024, 3:30 PMdefault_browser_return_url
is used by Ory Kratos to redirect the user after a successful registration flow. However, in your onRegistrationSubmit
function, it seems like you're manually handling the redirection using the history.push
method.
Here is your onRegistrationSubmit
function for reference:
javascript
const onRegistrationSubmit = (body: UpdateRegistrationFlowBody) => {
// something unexpected went wrong and the flow was not set
if (!flow) return history.push('/registration', { replace: true });
ory
.updateRegistrationFlow({
flow: flow.id,
updateRegistrationFlowBody: body,
})
.then(({ data }) => {
if ('continue_with' in data) {
for (const cw of data.continue_with ?? []) {
if (cw.action === 'show_verification_ui') {
const search = new URLSearchParams();
search.set('flow', cw.flow.id);
history.push(
{
pathname: '/verification',
search: search.toString(),
},
{ replace: true }
);
return;
}
}
}
})
.catch(sdkErrorHandler);
};
In this function, you're using the history.push
method to manually redirect the user to the /verification
route if the show_verification_ui
action is present in the continue_with
array. If the show_verification_ui
action is not present, no redirection occurs.chilly-king-10285
06/18/2024, 3:30 PMdefault_browser_return_url
is used by Ory Kratos to redirect the user after a successful registration flow. However, in your onRegistrationSubmit
function, it seems like you're manually handling the redirection using the history.push
method. Here is your onRegistrationSubmit
function for reference: javascript const onRegistrationSubmit = (body: UpdateRegistrationFlowBody) => { // something unexpected went wrong and the flow was not set if (!flow) return history.push('/registration', { replace: true }); ory .updateRegistrationFlow({ flow: flow.id, updateRegistrationFlowBody: body, }) .then(({ data }) => { if ('continue_with' in data) { for (const cw of data.continue_with ?? []) { if (cw.action === 'show_verification_ui') { const search = new URLSearchParams(); search.set('flow', cw.flow.id); history.push( { pathname: '/verification', search: search.toString(), }, { replace: true } ); return; } } } }) .catch(sdkErrorHandler); };
In this function, you're using the history.push
method to manually redirect the user to the /verification
route if the show_verification_ui
action is present in the continue_with
array. If the show_verification_ui
action is not present, no redirection occurs. If you want to use the default_browser_return_url
for redirection after a successful password registration, you might need to adjust your function to handle this. However, without more information about your overall application structure and how you're handling Ory Kratos flows, it's hard to provide a specific solution. If you're still having issues, consider reaching out to the Ory community or support for further assistance.