KindeK
Kinde8mo ago
3 replies
Jacob

Has anyone got Kinde Auth working with the Supabase browser client?

We need multi tenancy and somewhat advanced role and permission based RLS policies. Because of this, we were hoping to use Kinde for our identity provider alongside Supabase. I've been able to get server-side requests working by following the Kinde and Supabase blog, however we rely heavily on the supabase client-side SDK as well so need this to work if we are to switch to Kinde auth

The createBrowserClient function from Supabase does allow you to pass in a custom access token,

 return createBrowserClient<Database>(
      process.env.NEXT_PUBLIC_SUPABASE_URL!,
      process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!,
      {
        accessToken: async () => {
          // return kinde token here
        },
      },
    );


but the accessTokenRaw I obtain from useKindeBrowserClient is unsigned and therefore does not work.

Does anyone have this working for their app? Are there any suggestions on how this can be setup, without needing to proxy all our requests through an api route and sign + attach the token to the request? Because this would remove a large part of the benefit of using supabase with their nice client SDKs

Appreciate any insights! Thanks
Was this page helpful?