Skip to content

Commit 3d671d0

Browse files
committed
fix: clears the session when a user signs up
1 parent e8c3ab3 commit 3d671d0

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@supabase/supabase-js",
3-
"version": "0.35.3",
3+
"version": "0.35.4",
44
"description": "Supabase Realtime API",
55
"main": "./lib/index.js",
66
"scripts": {

src/Auth.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ class Auth {
1818
.post(`${authUrl}/signup`, { email, password })
1919
.set('accept', 'json')
2020
.set('apikey', this.supabaseKey)
21-
21+
22+
this.removeSavedSession() // clean out the old session before returning
2223
return response
2324
}
2425

@@ -78,8 +79,6 @@ class Auth {
7879
.set('Authorization', `Bearer ${this.accessToken}`)
7980
.set('apikey', this.supabaseKey)
8081

81-
this.currentUser = null
82-
this.accessToken = null
8382
this.removeSavedSession()
8483
}
8584

@@ -105,6 +104,8 @@ class Auth {
105104
}
106105

107106
this.removeSavedSession = () => {
107+
this.currentUser = null
108+
this.accessToken = null
108109
isBrowser() && localStorage.removeItem(storageKey)
109110
}
110111

0 commit comments

Comments
 (0)