Skip to content

Commit 5f60fc4

Browse files
feat: add in new flowType param and event
1 parent 526abb0 commit 5f60fc4

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/SupabaseClient.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ const DEFAULT_AUTH_OPTIONS: SupabaseAuthClientOptions = {
3030
autoRefreshToken: true,
3131
persistSession: true,
3232
detectSessionInUrl: true,
33+
flowType: 'implicit',
3334
}
3435

3536
const DEFAULT_REALTIME_OPTIONS: RealtimeClientOptions = {}
@@ -244,6 +245,7 @@ export default class SupabaseClient<
244245
detectSessionInUrl,
245246
storage,
246247
storageKey,
248+
flowType,
247249
}: SupabaseAuthClientOptions,
248250
headers?: Record<string, string>,
249251
fetch?: Fetch
@@ -260,6 +262,7 @@ export default class SupabaseClient<
260262
persistSession,
261263
detectSessionInUrl,
262264
storage,
265+
flowType,
263266
fetch,
264267
})
265268
}
@@ -291,7 +294,7 @@ export default class SupabaseClient<
291294
this.realtime.setAuth(token ?? null)
292295

293296
this.changedAccessToken = token
294-
} else if (event === 'SIGNED_OUT' || event === 'USER_DELETED') {
297+
} else if (event === 'SIGNED_OUT') {
295298
// Token is removed
296299
this.realtime.setAuth(this.supabaseKey)
297300
if (source == 'STORAGE') this.auth.signOut()

src/lib/types.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ export type SupabaseClientOptions<SchemaName> = {
3636
* A storage provider. Used to store the logged-in session.
3737
*/
3838
storage?: SupabaseAuthClientOptions['storage']
39+
/**
40+
* OAuth flow to use - defaults to implicit flow. PKCE is recommended for mobile and server-side applications.
41+
*/
42+
flowType?: SupabaseAuthClientOptions['flowType']
3943
}
4044
/**
4145
* Options passed to the realtime-js instance

0 commit comments

Comments
 (0)