Using Next.js and Auth0 with Supabase

Learn how to integrate Auth0 authentication with database storage and row-level security authorization in Supabase.
Read more…

:writing_hand:t2: Brought to you by our guest author Jon Meyers

1 Like

What’s up Devs! Please share any comments or feedback with us on this thread

Thanks for this great article! One Typescript question:

export const getSupabase = (access_token?: any) => {
  const supabaseClient = createClient(

  if (access_token) {
    // Typescript error here
    supabaseClient.auth.session = () => ({

  return supabaseClient;

I’m getting the following Typescript error:

Type '{ access_token: any; }' is missing the following properties from type 'Session': token_type, userts(2739)
1 Like

Hey there @juanzgc!

Feel free to DM @dijonmusters about that through his Twitter profile that he provided

@dijonmusters this guide is now outdated based on the row level security updates in this release. I just spent a day trying to figure out why the RLS wouldn’t work :slightly_smiling_face:. Could you update the documentation here?

For anyone else who finds this, you need to replace

create or replace function auth.user_id() returns text as $$
  select nullif(current_setting('request.jwt.claim.userId', true), '')::text;
$$ language sql stable;


create or replace function auth.user_id() 
returns text 
language sql stable
as $$
  select (current_setting('', true)::jsonb ->> 'userId')::text

Thanks a lot for sharing that with the rest of community!

This topic was automatically closed after 29 days. New replies are no longer allowed.