Use your Supabase client with Kobble authentication SDK
Create a SQL query that checks the user ID
request_user_id()
, which will get the Kobble user ID of the requesting user from the request headers.This will allow you to access the user ID in your RLS policies that we’ll configure later.Add a column for user IDs to your Supabase tables
user_id
column to a Posts
table as an example.So we’ll assume that you have a Posts
table in your Supabase database and we want only Post owners to be able to create, update, and view their own posts.user_id
column to.user_id
text
(request_user_id())
. This will make it default to the return value of the custom function we’ve defined earlier. Doing this user’s ID will be available to Supabase from the request headers.Create RLS policies based on the User ID
INSERT
policy but for to allow UPDATE
and SELECT
operations:Get your Supabase JWT secret key
Setup your supabase client
Use the Supabase client in your app