© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•7mo ago•
2 replies
Surya

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?

Thanks in advance 🙏
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Edge Function - User authentication from Bearer - how to?
SupabaseSSupabase / help-and-questions
4y ago
How to return an error from an edge function
SupabaseSSupabase / help-and-questions
4y ago
Edge function giving Invalid JWT
SupabaseSSupabase / help-and-questions
7mo ago
How to verify JWT on Edge Functions
SupabaseSSupabase / help-and-questions
3y ago