Correct way to use a JWT on the server side to initialize a client as that user?

Most of the documentation seems to assume you're using supabase on both browser client and api side. We have a custom GQL api that needs to get the users JWT from Authorization header and create a client as that user for the duration of that request.

Attempting to use this in my request context (ApolloGQL server)
export const getClient = (token?: string): SupabaseClient => {
  return createClient(SUPABASE_API_URL, token || SUPABASE_ANON_TOKEN);
};


This doesn't seem to create me a client authorized as that user (token is the JWT from Authorization header)

supabase.auth.user() is null but tells me I should use auth.api.getUserByCookie() to do this in the server context. But I'm not using a cookie or any type of session management
Was this page helpful?