Authentication with Supabase
Authentication with Supabase
KikiWriting uses Supabase Auth for authentication, supporting both server-side authentication with service keys and client-side authentication with JWT tokens.
Understanding Supabase Authentication
Supabase provides two main authentication mechanisms:
- Service Role Key (server-side): Has full access to your database, bypassing Row Level Security (RLS)
- JWT Authentication (client-side): User-specific tokens that respect Row Level Security policies
Server-Side Authentication with Supabase Secret
Step 1: Configuring Supabase Secret
Store your Supabase secret key in your .env file:
Step 2: Validating JWT Tokens
Ensure that you replace your-supabase-url.supabase.co
and your-public-anon-key
with your actual Supabase project URL and public key.
Client-Side Authentication with JWT Tokens
Using JWT Tokens for Authentication
To authenticate users on the client side, you can use the Supabase client library. Here's an example:
I will implement a JWT Validate Service and write to the docs later.