supabase / supabase-js

An isomorphic Javascript client for Supabase. Query your Supabase database, subscribe to realtime events, upload and download files, browse typescript examples, invoke postgres functions via rpc, invoke supabase edge functions, query pgvector.
https://supabase.com
MIT License
2.86k stars 220 forks source link

`detectSessionInUrl` not used when `pkce` flowType configured #931

Open arobert93 opened 4 months ago

arobert93 commented 4 months ago

Bug report

Describe the bug

This is related to GoTrueClient.

When settings detectSessionInUrl to false it is not used when flowType is pkce.

To Reproduce

Due to this initialization code of GoTrueClient:

  private async _initialize(): Promise<InitializeResult> {
    try {
      const isPKCEFlow = isBrowser() ? await this._isPKCEFlow() : false
      this._debug('#_initialize()', 'begin', 'is PKCE flow', isPKCEFlow)

      if (isPKCEFlow || (this.detectSessionInUrl && this._isImplicitGrantFlow())) {
        const { data, error } = await this._getSessionFromURL(isPKCEFlow)

Expected behavior

I expect it to respect the detectSessionInUrl configuration.

Screenshots

System information

Additional context

j4w8n commented 4 months ago

What's your use-case here?

arobert93 commented 4 months ago

@j4w8n I need to have full control over the flow. On initialize it automatically reads the URL and removes the params then uses them. I want to manually handle this.