Hello :wave: I’ve been working on a self-hosting ...
# ory-selfhosting
s
Hello 👋 I’ve been working on a self-hosting implementation using the kratos-selfservice-ui-node repo for the auth UI. Everything is working great, except this message that displays on login redirects.
The JS code that redirects to login:
Copy code
const sdkUrl = isSignupFlow ? await sdk.createBrowserRegistrationFlow() : await sdk.createBrowserLoginFlow();
const url = new URL(sdkUrl.data.ui.action);
url.searchParams.set('return_to', redirectTo);

// redirect to the login/signup flow
window.location.assign(url);
A
GET
seems appropriate here, but I can change to a POST/PUT/PATCH, I just wanted to make sure that’s intentional.
b
Instead of creating the flow here, Kratos expects you to redirect to the createBrowser{Registration|Login}Flow urls. so for login
<kratos>/selfservice/login/browser
and for registration
<kratos>/selfservice/registration/browser
It will create the flow for you, and redirect the user's browser back to your UI.
s
Thanks Jonas! Is there a way to pull these URLs from the FrontendApi?
b
You can, but it's bit awkward. I'd suggest just hardcoding them in your application. They aren't going to change.
s
Thanks for the quick reply, I’ll give it a shot!
Should
<kratos>
be the 4433 port or the 4455 (node admin) port?
It was 4433.
b
Yes, the public kratos URL
s
I had to change
selfservice
to
self-service
to anyone looking at this later.
b
ah, damn, I always confuse that. Thanks for the correction!
s
Thank you!