microscopic-answer-24504
01/13/2023, 12:01 PMsteep-lamp-91158
return_to
is the address to return after a successful login
this request redirects you to the login UI urlbrash-cartoon-33648
01/13/2023, 1:02 PM/registration?flow=XXX&return_to=YYY
all works as expectedsteep-lamp-91158
return_to
is preserved on the backend
did you try it?brash-cartoon-33648
01/13/2023, 1:05 PM/abc
2. get redirected to login
3. I don't have an account yet, so click register
4. after register get redirected to default redirect urlbrash-cartoon-33648
01/13/2023, 1:05 PMbrash-cartoon-33648
01/13/2023, 1:07 PM/login?flow=XXX&return_to=/abc
, the register button inherits the redirect paramsteep-lamp-91158
return_to
param
2. user is redirected to login UI with the flow ID
3. the login UI fetches the flow (FE or BE) and renders the page
4. user clicks on register and is redirected to create a new registration flow but without the return_to
param
5. user is redirected to the registration UI
6. ...
now all you have to do is append the return_to
from the login flow to the registration button in the front end, it is included in the GET login flow response https://www.ory.sh/docs/reference/api#tag/frontend/operation/getLoginFlowbrash-cartoon-33648
01/13/2023, 1:15 PMgetLoginFlow
?steep-lamp-91158
steep-lamp-91158
steep-lamp-91158
brash-cartoon-33648
01/13/2023, 1:20 PMreturn_to
next to the flowID and then either ignore or use it in the UI, prevents one extra HTTP requeststeep-lamp-91158
steep-lamp-91158
brash-cartoon-33648
01/13/2023, 1:21 PMbrash-cartoon-33648
01/13/2023, 1:23 PMbrash-cartoon-33648
01/13/2023, 1:25 PMbrash-cartoon-33648
01/13/2023, 1:26 PM/login?flow=xxx
urlbrash-cartoon-33648
01/13/2023, 1:29 PMselfservice:
flows:
# global option
append_return_to: true
error:
# ...
append_return_to: true
settings:
# ...
append_return_to: true
recovery:
# ...
append_return_to: true
verification:
# ...
append_return_to: true
logout:
# ...
append_return_to: true
login:
# ...
append_return_to: true
registration:
# ...
append_return_to: true
steep-lamp-91158
brash-cartoon-33648
01/13/2023, 1:32 PMsteep-lamp-91158