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

provider_token is missing for Twitch authentication

Open mobychan opened this issue 3 years ago • 1 comments
trafficstars

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

  • OS: macOS
  • Browser: Chrome
  • Version of supabase-js: 2.1.0

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 :)

mobychan avatar Nov 19 '22 20:11 mobychan

Same for me !

benjipott avatar Aug 15 '24 08:08 benjipott

HI @mobychan ! Thank you very much for submitting an issue! Can you please provide a minimal reproduction repository? It will really help me debug this!

mandarini avatar Sep 05 '25 14:09 mandarini