Skip to content

Commit 48f21e1

Browse files
authored
fix: don't remove session in resend (#717)
## What kind of change does this PR introduce? Bug fix ## What is the current behavior? When you call the `resend` method to e.g. resend an email to change your email, you get logged out. ## What is the new behavior? On email and phone change you don't get logged out. ## Additional context I noticed this when implementing this method in gotrue-dart supabase/supabase-flutter#517 (comment)
1 parent 44af61e commit 48f21e1

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/GoTrueClient.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -724,7 +724,11 @@ export default class GoTrueClient {
724724
*/
725725
async resend(credentials: ResendParams): Promise<AuthOtpResponse> {
726726
try {
727-
await this._removeSession()
727+
728+
if (credentials.type != "email_change" && credentials.type != "phone_change") {
729+
await this._removeSession();
730+
}
731+
728732
const endpoint = `${this.url}/resend`
729733
if ('email' in credentials) {
730734
const { email, type, options } = credentials

0 commit comments

Comments
 (0)