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
3.27k stars 271 forks source link

provider_token is missing for Twitch authentication #643

Open mobychan opened 2 years ago

mobychan commented 2 years ago

Bug report

Describe the bug

I have a sveltekit project, in which I want to use some Twitch API features. I switched to supebase v2 because of the "refresh_token" problems. I'm using this to sign in using Twitch:

await supabase.auth.signInWithOAuth({
    provider: 'twitch',
    options: {
        redirectTo: supabaseRedirect,
        scopes: 'channel:manage:redemptions channel:read:redemptions'
    }
});

Later, on a different route I try to get the provider_token using this:

const sess = await supabase.auth.getSession();
const providerToken = sess?.data.session?.provider_token || '';

But "provider_token" as well as "provider_refresh_token" are always undefined.

Is there a step I'm missing? It worked in v1 (with the old methods).

To Reproduce

Sign in using Twitch:

await supabase.auth.signInWithOAuth({
    provider: 'twitch',
    options: {
        redirectTo: supabaseRedirect,
        scopes: 'channel:manage:redemptions channel:read:redemptions'
    }
});

Afterwards try to get the "provider_token": Sign in using Twitch:

const sess = await supabase.auth.getSession();
const providerToken = sess?.data.session?.provider_token || '';

-> "provider_token" as well as "provider_refresh_token" are empty.

Expected behavior

Both "provider_token" as well as "provider_refresh_token" set to the appropriate values.

Screenshots

I guess screenshots are not needed?

System information

Additional context

My session object looks like this:

access_token: "ACCESS_TOKEN",
expires_at: 1668892877,
expires_in: 3600,
refresh_token: "s0vl3SQJZg89Abl3N5ck8A",
token_type: "bearer",
user: { USER OBJECT}

If anything else is needed or I should create a minimal reproduction repro please tell me :)

benjipott commented 3 months ago

Same for me !