How to create a JWT for a specific user from an Edge Function?
Hi everyone,
I’m trying to create an Edge Function in Supabase that can generate a JWT for a specific user (identified by user_id or email) so that it can be used for server-to-server requests.
My use case: I want to build a feature where a user can schedule a task. The scheduled task will need to run with a valid JWT token on behalf of that user.
What I want to achieve:
Thanks in advance
I’m trying to create an Edge Function in Supabase that can generate a JWT for a specific user (identified by user_id or email) so that it can be used for server-to-server requests.
My use case: I want to build a feature where a user can schedule a task. The scheduled task will need to run with a valid JWT token on behalf of that user.
What I want to achieve:
- Input: user_id or email
- Output: A valid JWT for the authenticated role (usable to query Supabase API on behalf of that user)
Thanks in advance