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

Can't set JWT header #1290

Closed
willsmanley opened this issue Oct 19, 2024 · 1 comment
Closed

Can't set JWT header #1290

willsmanley opened this issue Oct 19, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@willsmanley
Copy link

In the python SDK, I am able to set a JWT as a header that I already have to simulate a user request for RLS purposes:

anon_key = '123'
jwt = '123'
url = 'mysupabase.com' 
client_options = ClientOptions(headers={"apiKey": anon_key, "Authorization": f"Bearer {jwt}"})
supabase: Client = create_client(url, anon_key, client_options)

However in the JS SDK, the same thing doesn't work:

anon_key = '123'
jwt = '123'
url = 'mysupabase.com' 
const supabase = createClient(url, anon_key, {
    global: {
        headers: {"apiKey": anon_key, "Authorization": "Bearer " + jwt}
    }
});

The request still fires, but I get an empty response indicating that I did not pass the RLS policy of auth.uid() = user_id for the query

I'd love to help try to inspect how this actually results in different network requests, but not sure where to dig into.

Thank you for the amazing library!

@willsmanley willsmanley added the bug Something isn't working label Oct 19, 2024
@willsmanley
Copy link
Author

ah silly mistake my JWT was invalid. closing!

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

No branches or pull requests

1 participant