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: 1. Input: user_id or email 2. Output: A valid JWT for the authenticated role (usable to query Supabase API on behalf of that user)
Is there any built-in method or recommended approach to generate such a token from an Edge Function?
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.