supabase-js icon indicating copy to clipboard operation
supabase-js copied to clipboard

`detectSessionInUrl` not used when `pkce` flowType configured

Open acomanescu opened this issue 1 year ago • 7 comments

Bug report

  • [x] I confirm this is a bug with Supabase, not with my own application.
  • [x] I confirm I have searched the Docs, GitHub Discussions, and Discord.

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

  • OS: macOS
  • Browser: -
  • Version of supabase-js: 2.39.1
  • Version of Node.js: -

Additional context

acomanescu avatar Dec 20 '23 12:12 acomanescu

What's your use-case here?

j4w8n avatar Dec 29 '23 19:12 j4w8n

@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.

acomanescu avatar Dec 29 '23 19:12 acomanescu