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

return type of `getAuthorizationDetails` is wrong

Open Kroppeb opened this issue 1 month ago • 1 comments

Describe the bug

I kept getting errors while implementing oauth and couldn't figure out why. getAuthorizationDetails is typed as returning AuthOAuthAuthorizationDetailsResponse. This however is not correct. It's possible for the data to only contain a redirect_url when the user has already approved access to that client.

so it's a AuthOAuthConsentResponse instead of a AuthOAuthAuthorizationDetailsResponse

Library affected

supabase-js

Reproduction

No response

Steps to reproduce

No response

System Info

System:
    OS: Windows 11 10.0.26100
    CPU: (16) x64 12th Gen Intel(R) Core(TM) i7-12650H
    Memory: 2.61 GB / 23.73 GB
  Binaries:
    Node: 20.11.0 - C:\Program Files\nodejs\node.EXE
    npm: 10.2.4 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Chromium (131.0.2903.112)
    Firefox: 146.0.1 - C:\Program Files\Mozilla Firefox\firefox.exe
    Internet Explorer: 11.0.26100.7309

Used Package Manager

npm

Logs

I used the following snippet to figure out what was going on:

// Fetch authorization details from Supabase
  const { data: authDetails, error: authError } = await supabase.auth.oauth.getAuthorizationDetails(authorizationId)
  console.log('Auth Details:', authDetails, 'Auth Error:', authError)

and got the following log:

Auth Details: {
  redirect_url: 'http://localhost:8080/oidc/callback?code=REDACTED&state=REDACTED'
} Auth Error: null

Validations

Kroppeb avatar Jan 14 '26 21:01 Kroppeb

~~hi @Kroppeb 💚
thanks for pointing this up.
creating a pr asap!~~

7ttp avatar Jan 15 '26 06:01 7ttp

Fixed here: https://github.com/supabase/supabase-js/pull/2088

mandarini avatar Feb 04 '26 14:02 mandarini