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

Use user token in the client #61

Open
deniurchak opened this issue Aug 25, 2024 · 0 comments
Open

Use user token in the client #61

deniurchak opened this issue Aug 25, 2024 · 0 comments

Comments

@deniurchak
Copy link

hey guys!

I receive the requests from the frontend with my users's Supabase JWT. I want to use a client with anonymous key and RLS for my requests on the backend. I've been able to set the user token to impersonate them by manually setting the Auth header on the DB instance like this:

	client.DB.AddHeader("Authorization", fmt.Sprintf("Bearer %s", token))

Hence, three questions:

  1. is there a better way to do it?
  2. should storage support it was well? (currently no way to set headers on the storage client), so I need to implement my own http logic for authenticated storage requests
  3. should we implement something like client.SetToken(userJwt) for to make all requests user-authenticated?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant