Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access Denied when making rpc call. #590

Closed
akarshghale opened this issue Oct 14, 2023 · 1 comment
Closed

Access Denied when making rpc call. #590

akarshghale opened this issue Oct 14, 2023 · 1 comment
Labels
bug Something isn't working postgrest Issues related to postgrest-py

Comments

@akarshghale
Copy link

Describe the bug
Hi, I am getting an 'access denied' error when I use supabase rpc call.

Error:
2023-10-14 16:57:16,384:INFO - HTTP Request: POST https://xxxx.supabase.co/rest/v1/rpc/set_claim "HTTP/1.1 200 OK"
data='error: access denied' count=None

To Reproduce
Steps to reproduce the behavior:

def rpc_procedure(user_id):
    response = supabase.rpc(
        fn="set_claim",
        params={"uid": str(user_id), "claim": "user_role", "value": "individual"}
    ).execute()
    print(response)
    return

Expected behavior
Should run the function without causing any errors.

Desktop (please complete the following information):

  • OS: MacOs
  • Version: Latest
@anand2312 anand2312 added bug Something isn't working postgrest Issues related to postgrest-py labels Oct 14, 2023
@akarshghale
Copy link
Author

akarshghale commented Oct 14, 2023

Hi,

The issue is that the custom claim requires claims_admin permission hence the denial.

Ways to fix this:

Create a special admin user and give claims_admin permissions and then use that user as a way to interact with these functions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working postgrest Issues related to postgrest-py
Projects
None yet
Development

No branches or pull requests

2 participants