0
0
Supabasecloud~10 mins

Why Supabase Auth handles identity - Test Your Understanding

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

Complete the code to initialize Supabase Auth client.

Supabase
const supabase = createClient([1], 'public-anon-key');
Drag options to blanks, or click blank then click option'
ADATABASE_URL
BSUPABASE_URL
CAPI_KEY
DAUTH_TOKEN
Attempts:
3 left
💡 Hint
Common Mistakes
Using API key instead of the project URL.
Confusing database URL with Supabase URL.
2fill in blank
medium

Complete the code to sign in a user with email and password.

Supabase
const { data, error } = await supabase.auth.[1]({ email, password });
Drag options to blanks, or click blank then click option'
Aauthenticate
Bregister
CloginUser
DsignInWithPassword
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'register' instead of 'signInWithPassword'.
Using non-existent methods like 'authenticate'.
3fill in blank
hard

Fix the error in the code to get the current authenticated user.

Supabase
const { data: { user }, error } = await supabase.auth.[1]();
Drag options to blanks, or click blank then click option'
AgetUser
BcurrentUser
Cuser
DgetCurrentUser
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'user' property directly which does not exist.
Using 'currentUser' which is not a Supabase method.
4fill in blank
hard

Fill both blanks to handle sign out and listen for auth state changes.

Supabase
await supabase.auth.[1]();
supabase.auth.onAuthStateChange((event, session) => { console.log(event, session); }, [2]);
Drag options to blanks, or click blank then click option'
AsignOut
BsignIn
CSIGNED_IN
DSIGNED_OUT
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'signIn' instead of 'signOut' to log out.
Listening for 'SIGNED_IN' event when expecting sign out.
5fill in blank
hard

Fill all three blanks to update user metadata after authentication.

Supabase
const { data, error } = await supabase.auth.updateUser({ [1]: [2] });
console.log([3]);
Drag options to blanks, or click blank then click option'
Adata
Buser_metadata
Cerror
DnewMetadata
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong keys like 'data' instead of 'user_metadata'.
Logging the wrong variable after update.