return type of `getAuthorizationDetails` is wrong
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
- [x] Follow our Code of Conduct
- [x] Read the Contributing Guidelines.
- [x] Read the docs.
- [x] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- [x] Make sure this is a Supabase JS Library issue and not an issue with the Supabase platform. If it's a Supabase platform related bug, it should likely be reported to supabase/supabase instead.
- [x] Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- [x] The provided reproduction is a minimal reproducible example of the bug.
~~hi @Kroppeb 💚
thanks for pointing this up.
creating a pr asap!~~
Fixed here: https://github.com/supabase/supabase-js/pull/2088