This is a contributors guide and NOT a user guide. Please visit these docs if you are using or evaluating SuperTokens.
This is just a proposal so far, it hasn't been accepted and needs further discussion.
Apps have to handle redirection if a claim fails and also handle redirecting back if necessary. E.g.:
- While using a custom 2FA claim, the app has to check if there is a validation error for the claim in the
invalidClaimsarray and handle redirection.
- On the 2FA page, the app has to check if that validation error disappeared (so the user successfully logged in using 2FA)
- Recommend creating wrapper components
- Add a callback that returns a react component to render on failure
- Add callbacks (onFailure, onSuccess) that returns a string (or undefined) we can redirect to
- Add a separate component that handles these checks/mapping
Add callbacks (onFailure, onSuccess) that returns a string (or undefined) we can redirect to.
We've also decided to add a default access denied screen where we can redirect in case of an unhandled claim failure.
- this is triggered when a claim fails without a defined onFailure CB
- this could get: overridden as a component, overridden with getRedirectToPath in the session init
In this case we embed the contact info in the link which enables us to show the sign in screen but we can delay the consume (on the FE) until the validation info is fetched.