Examples
Reset a forgotten password
Request a reset mail, set a new password, then sign in.
Recover access when the user forgot the password. Routes sit on the management group (facade default /identity). Mail is sent only for a confirmed account. The forgot endpoint always returns 200.
Steps
- Collect the account email on a Forgot password screen.
POST /identity/forgotPasswordwith body{ "email" }.- On
200, show Check your email (same copy for known and unknown addresses). - The reset mail carries a Base64Url-encoded reset code.
IEmailSender<TUser>.SendPasswordResetCodeAsyncreceives an HTML-encoded Base64Url string (hosts that put the code in an HTML mail should decode entities before the user copies it, or use a link query the host owns). The client submits the Base64Url value asresetCode. - Collect email, reset code, and new password on a Reset password screen (or deep link that fills email and code).
POST /identity/resetPasswordwith body{ "email", "resetCode", "newPassword" }.- On
200, sign in with the new password:POST /identity/login(LoginCookie). Persistent cookie:?useSessionCookies=false. See Cookie auth. - On invalid or unknown token or user, expect
400validation problem (for exampleInvalidToken). Do not reveal whether the email exists from the forgot step.
Forgot and reset do not require antiforgery or a session.