File tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,8 @@ import Realtime from './Realtime'
3
3
import { Auth } from './Auth'
4
4
import { PostgrestClient } from '@supabase/postgrest-js'
5
5
6
+ const DEPRICATED_KEY_LENGTH = 45
7
+
6
8
class SupabaseClient {
7
9
constructor ( supabaseUrl , supabaseKey , options = { autoRefreshToken : true } ) {
8
10
this . supabaseUrl = null
@@ -91,7 +93,8 @@ class SupabaseClient {
91
93
initClient ( ) {
92
94
let headers = { apikey : this . supabaseKey }
93
95
94
- if ( this . auth . authHeader ( ) ) headers [ 'Authorization' ] = this . auth . authHeader ( )
96
+ if ( this . supabaseKey . length > DEPRICATED_KEY_LENGTH && this . auth . authHeader ( ) )
97
+ headers [ 'Authorization' ] = this . auth . authHeader ( )
95
98
96
99
let rest = new PostgrestClient ( this . restUrl , {
97
100
headers,
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ describe('test signing up and logging in as a new user', () => {
15
15
it ( 'should register a new user' , async ( ) => {
16
16
try {
17
17
const response = await supabase . auth . signup ( randomEmail , '11password' )
18
- assert ( response . body . email === randomEmail , 'user could not sign up' )
18
+ assert ( response . body . user . email === randomEmail , 'user could not sign up' )
19
19
} catch ( error ) {
20
20
assert ( ! error , 'sign up returns an error' )
21
21
}
You can’t perform that action at this time.
0 commit comments