ory / kratos-selfservice-ui-node

Apache License 2.0
314 stars 207 forks source link

fix: let kratos handle session redirects #304

Closed Benehiko closed 10 months ago

Benehiko commented 10 months ago

When users have a session and they are redirected to the registration UI on the account experience, they will end up on the /welcome page. This is due to the session check happening in the Express middleware. This is incorrect behavior since the redirect to the welcome route is hard coded and not an ideal route to leave the user at.

In OAuth flows, this is even more confusing, since the OAuth flow has its own logic when a session is present. OAuth flows usually redirect to the consent route if a session is present and there were no subject mismatches.

This PR removes the session check middleware on the registration route and allows Kratos to handle the redirect logic for us.

Related Issue or Design Document

https://github.com/ory-corp/cloud/issues/5493 https://github.com/ory/kratos/pull/3592

Checklist

Further comments