Skip to content

Commit 7dc1837

Browse files
fix: set cookies for password recovery event (#32)
## What kind of change does this PR introduce? Bug fix ## What is the current behavior? When resetting a user's password with an email template which has a URL defining the `type` value as `recovery`, and using the `verifyOtp` method to process the token_hash and type, the SSR server client's `onAuthStateChange` function does not recognize the `PASSWORD_RECOVERY` event that verifyOtp fires. This prevents the code [here](https://github.com/supabase/ssr/blob/main/src/createServerClient.ts#L199-L205) from running; resulting in the new session not being saved to cookies, and the user is not considered logged in. Fixes #21 ## What is the new behavior? User is logged in. ## Additional context Replaces PR #24 Co-authored-by: Jason Creviston <[email protected]>
1 parent bebce89 commit 7dc1837

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/createServerClient.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ export function createServerClient<
193193
(event === "SIGNED_IN" ||
194194
event === "TOKEN_REFRESHED" ||
195195
event === "USER_UPDATED" ||
196+
event === "PASSWORD_RECOVERY" ||
196197
event === "SIGNED_OUT" ||
197198
event === "MFA_CHALLENGE_VERIFIED")
198199
) {

0 commit comments

Comments
 (0)