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

Allow createClient() to use user's jwt without the need for anon key #186

Closed
kk21 opened this issue Nov 28, 2021 · 1 comment
Closed

Allow createClient() to use user's jwt without the need for anon key #186

kk21 opened this issue Nov 28, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@kk21
Copy link

kk21 commented Nov 28, 2021

Feature request

Is your feature request related to a problem? Please describe.

Allow createClient() to use user's jwt so that the client does not need anon key:
const supabase = createClient(url, user's jwt);

Currently this will not work for Realtime which gives repeated WebSocket connection failed errors.

Just to provide more context, my web client gets the user's jwt by signing in indirectly through my own custom API server, so it does not need the anon key to call Supabase API.

Describe the solution you'd like

Allow createClient() to use user's jwt without the need for anon key.

Describe alternatives you've considered

Currently the solution is to use anon key for createClient(), followed by:
supabase.auth.setAuth(user's jwt)

@hf
Copy link
Contributor

hf commented Sep 30, 2022

Hey @kk21, this was intentional in v1. You can think of the anon key more as an API key rather than a substitute for a user's JWT. We don't plan on changing the behavior to keep it consistent across the other Supabase JS client libraries.

@hf hf closed this as not planned Won't fix, can't repro, duplicate, stale Sep 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants