Skip to main content

Sign in

The sign in flow follows the same pattern as the sign up flow but instead of redirecting to the registration page, it redirects to the login page.

app.get("/", (req, res) => {
ory
.toSession({ cookie: req.header("cookie") })
.then((data) => res.json(data))
.catch(() =>
res.redirect(`${process.env.ORY_SDK_URL}/self-service/login/browser`),
)
})

You can alternatively set return_to to a custom URL. This custom URL must be allow-listed in your project's configuration; otherwise, the request will fail. If allow-listed, this URL will be used as the return URL for the sign in flow:

https://$ORY_SDK_URL/self-service/login/browser?return_to=https://example.com/dashboard