Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using localhost URL instead of the Supabase project URL.
Using unrelated URLs like Google or GitHub.
✗ Incorrect
The Supabase client needs the project URL to connect properly.
2fill in blank
mediumComplete 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'GitHub' or other providers instead of 'google'.
Capitalizing the provider name incorrectly.
✗ Incorrect
To sign in with Google, the provider must be set to 'google'.
3fill in blank
hardFix 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Capitalizing provider name incorrectly.
Using underscores or camelCase in provider name.
✗ Incorrect
The provider name must be all lowercase 'github' to work correctly.
4fill in blank
hardFill 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a wrong redirect URL not registered in GitHub app settings.
Using invalid or unsupported scopes.
✗ Incorrect
The redirect URL must be your app's callback URL, and scopes define permissions like 'read:user'.
5fill in blank
hardFill 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong provider string.
Checking wrong variable for errors.
Logging error object directly instead of its message.
✗ Incorrect
Use 'github' as provider, check if 'error' exists, and log 'error.message' for details.