0
0
Supabasecloud~10 mins

OAuth providers (Google, GitHub) in Supabase - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to initialize Supabase client with the correct URL.

Supabase
const supabase = createClient('[1]', 'public-anon-key');
Drag options to blanks, or click blank then click option'
Ahttps://xyzcompany.supabase.co
Bhttp://localhost:3000
Chttps://api.github.com
Dhttps://google.com
Attempts:
3 left
💡 Hint
Common Mistakes
Using localhost URL instead of the Supabase project URL.
Using unrelated URLs like Google or GitHub.
2fill in blank
medium

Complete the code to start OAuth sign-in with Google provider.

Supabase
const { data, error } = await supabase.auth.signInWithOAuth({ provider: '[1]' });
Drag options to blanks, or click blank then click option'
Agithub
Btwitter
Cfacebook
Dgoogle
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'GitHub' or other providers instead of 'google'.
Capitalizing the provider name incorrectly.
3fill in blank
hard

Fix the error in the code to sign in with GitHub OAuth provider.

Supabase
const { data, error } = await supabase.auth.signInWithOAuth({ provider: '[1]' });
Drag options to blanks, or click blank then click option'
AgitHub
BGitHub
Cgithub
Dgit_hub
Attempts:
3 left
💡 Hint
Common Mistakes
Capitalizing provider name incorrectly.
Using underscores or camelCase in provider name.
4fill in blank
hard

Fill both blanks to configure OAuth redirect URL and scopes for GitHub.

Supabase
const { data, error } = await supabase.auth.signInWithOAuth({ provider: 'github', options: { redirectTo: '[1]', scopes: '[2]' } });
Drag options to blanks, or click blank then click option'
Ahttps://myapp.com/callback
Bread:user
Cwrite:repo
Dhttps://example.com/redirect
Attempts:
3 left
💡 Hint
Common Mistakes
Using a wrong redirect URL not registered in GitHub app settings.
Using invalid or unsupported scopes.
5fill in blank
hard

Fill all three blanks to handle OAuth sign-in and check for errors.

Supabase
try {
  const { data, error } = await supabase.auth.signInWithOAuth({ provider: '[1]' });
  if ([2]) {
    console.error('Error:', [3]);
  }
} catch (err) {
  console.error('Unexpected error:', err);
}
Drag options to blanks, or click blank then click option'
Agoogle
Berror
Cerror.message
Dgithub
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong provider string.
Checking wrong variable for errors.
Logging error object directly instead of its message.