supabase-custom-claims icon indicating copy to clipboard operation
supabase-custom-claims copied to clipboard

Postgres 15

Open barbinbrad opened this issue 2 years ago • 4 comments

Bug report

Describe the bug

After upgrading to Postgres 15 an rpc call to get_claims gives the following response:

{
  error: null,
  data: {
    error:  'access denied'
  },
  count: null,
  status: 200,
  statusText: 'OK'
}

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

  1. Install the latest version of supabase and supabase-js.
  2. Run supabase.rpc("get_claims", { uid })

Expected behavior

Expect the claims from app_metadata to be returned.

barbinbrad avatar Jul 25 '23 04:07 barbinbrad

From what I can tell, the problem is with the is_claims_admin() function. If I remove the is_claims_admin() check from get_claims and get_claim -- I am unblocked, but I have a feeling this is not the "right" way. Any advice?

barbinbrad avatar Jul 25 '23 04:07 barbinbrad

getting the same like you when using "set_claim" in rpc (My supabase client has a service role key)

ZionLG avatar Nov 27 '23 18:11 ZionLG

getting the same like you when using "set_claim" in rpc (My supabase client has a service role key)

For set_claims this is what I've been doing instead:

getSupabaseServiceRole().auth.admin.updateUserById(userId, {
    app_metadata: claims,
  });

You can also try upgrading your supabase CLI -- as there was a bug in there that only surfaced when running locally.

barbinbrad avatar Nov 27 '23 18:11 barbinbrad

Any news on this? I seem to have stumbled on the same.

philmas avatar Feb 25 '24 18:02 philmas