@@ -20,21 +20,23 @@ class Auth {
20
20
. set ( 'accept' , 'json' )
21
21
. set ( 'apikey' , this . supabaseKey )
22
22
23
- if ( response . status === 200 && response [ 'body' ] [ 'user' ] [ 'confirmed_at' ] ) {
24
- this . accessToken = response . body [ 'access_token' ]
25
- this . refreshToken = response . body [ 'refresh_token' ]
26
- this . currentUser = response . body [ 'user' ]
27
- let tokenExpirySeconds = response . body [ 'expires_in' ]
28
- if ( this . autoRefreshToken && tokenExpirySeconds )
29
- setTimeout ( this . callRefreshToken , ( tokenExpirySeconds - 60 ) * 1000 )
30
- if ( this . persistSession ) {
31
- const timeNow = Math . round ( Date . now ( ) / 1000 )
32
- this . saveSession (
33
- this . accessToken ,
34
- this . refreshToken ,
35
- timeNow + tokenExpirySeconds ,
36
- this . currentUser
37
- )
23
+ if ( response . status === 200 ) {
24
+ if ( response [ 'body' ] [ 'user' ] ) {
25
+ this . accessToken = response . body [ 'access_token' ]
26
+ this . refreshToken = response . body [ 'refresh_token' ]
27
+ this . currentUser = response . body [ 'user' ]
28
+ let tokenExpirySeconds = response . body [ 'expires_in' ]
29
+ if ( this . autoRefreshToken && tokenExpirySeconds )
30
+ setTimeout ( this . callRefreshToken , ( tokenExpirySeconds - 60 ) * 1000 )
31
+ if ( this . persistSession ) {
32
+ const timeNow = Math . round ( Date . now ( ) / 1000 )
33
+ this . saveSession (
34
+ this . accessToken ,
35
+ this . refreshToken ,
36
+ timeNow + tokenExpirySeconds ,
37
+ this . currentUser
38
+ )
39
+ }
38
40
}
39
41
}
40
42
return response
0 commit comments