Skip to content

Use user token in the client #61

Open
@deniurchak

Description

@deniurchak

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions