WorkOS Docs Homepage
Integrations

Supabase + AuthKit

Learn how to use AuthKit with your Supabase application.

This guide outlines the steps to use WorkOS as a Supabase third-party auth provider. This will allow you to authenticate users with AuthKit and use AuthKit access tokens to access Supabase’s REST and GraphQL APIs in your app.

Configure a WorkOS integration in the Supabase dashboard.

Supabase 3rd party auth dashboard

Your issuer URL is:

WorkOS Issuer
Supabase WorkOS Connection dialog

Supabase RLS policies expect a role claim in the access token that corresponds to a database role. WorkOS already adds a role claim corresponding to the user’s role in an organization. Set up a JWT template in the WorkOS dashboard (Authentication → Sessions) so that the role works with Supabase:

JWT template
Handlebars

We add a user_role claim so that your application can still determine the role assigned to that user.

Pass in your WorkOS client ID and auth domain when initializing the Supabase client library.

Supabase client library initialization
JavaScript

That’s it! Supabase will now accept the access tokens returned by AuthKit.