Introduction
Supabase Auth manages who you are in an app. It keeps your login safe and simple.
Supabase Auth manages who you are in an app. It keeps your login safe and simple.
supabase.auth.signUp({ email: 'user@example.com', password: 'password123' })
supabase.auth.signInWithPassword({ email: 'user@example.com', password: 'password123' })
const { data: { user } } = await supabase.auth.getUser()const { data, error } = await supabase.auth.signUp({ email: 'alice@example.com', password: 'secret' })const { data, error } = await supabase.auth.signInWithPassword({ email: 'alice@example.com', password: 'secret' })const { data: { user } } = await supabase.auth.getUser()This code shows how Supabase Auth handles identity by signing up a user, signing them in, and then getting their current identity.
import { createClient } from '@supabase/supabase-js' const supabaseUrl = 'https://xyzcompany.supabase.co' const supabaseKey = 'public-anonymous-key' const supabase = createClient(supabaseUrl, supabaseKey) async function authFlow() { // Sign up a new user const { data: signUpData, error: signUpError } = await supabase.auth.signUp({ email: 'bob@example.com', password: 'mypassword' }) if (signUpError) { console.log('Sign up error:', signUpError.message) return } console.log('Sign up success:', signUpData.user.email) // Sign in the user const { data: signInData, error: signInError } = await supabase.auth.signInWithPassword({ email: 'bob@example.com', password: 'mypassword' }) if (signInError) { console.log('Sign in error:', signInError.message) return } console.log('Sign in success:', signInData.user.email) // Get current user const { data: { user: currentUser } } = await supabase.auth.getUser() console.log('Current user:', currentUser.email) } authFlow()
Supabase Auth stores user identity securely so you don't have to.
It supports many login methods like email, social logins, and magic links.
Always keep your Supabase keys safe and never expose secret keys in frontend code.
Supabase Auth manages user identity simply and securely.
It helps apps know who is using them without extra work.
Use it to add login and user tracking easily.
console.log(user.email) output after a successful login?const { data, error } = await supabase.auth.signInWithPassword({ email: 'user@example.com', password: 'pass123' }); const user = data.user;const { data, error } = await supabase.auth.signUp({ email: 'test@example.com' });Pass the test and this pattern moves unknown