edge-function-with-auth

Execute edge functions with JWT verification and role-based permission checks.

Updated May 30, 2026
One-click install
npx skills add https://github.com/buitrankimlong/thongtincty --skill edge-function-with-auth
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: edge-function-with-auth
Source: https://github.com/buitrankimlong/thongtincty/tree/main/.claude/skills/edge-function-with-auth
Command: npx skills add https://github.com/buitrankimlong/thongtincty --skill edge-function-with-auth

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

This Skill simplifies the creation and deployment of secure edge functions that require user authentication and permission checks, ensuring sensitive operations are protected.

Core Features & Use Cases

  • JWT Verification: Inline JWT decoding to avoid roundtrip authentication issues.
  • Permission Checks: Implementing 'has_permission' RPC gate for role-based access control.
  • Dual Authentication: Service-role bypass for cron/triggers and admin user JWT for flexibility.
  • Rate Limiting: Prevents abuse and ensures function availability.
  • Frontend Helper: 'invokeFunction' helper for easy function invocation from the frontend.
  • Use Case: Use this Skill to create secure edge functions like email senders, PDF generators, or external API callers that require authentication and permission checks.

Quick Start

Use the edge-function-with-auth skill to execute a secure, JWT-verified operation with permission checks on your edge function.

Frequently Asked Questions about edge-function-with-auth

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add JWT authentication and permission checks to an edge function?

To add JWT authentication and permission checks to an edge function, use inline JWT decoding for verification and implement a 'has_permission' RPC gate to enforce role-based access control before executing sensitive operations.

What is the best way to prevent abuse and rate limit edge functions?

The best way to prevent abuse and rate limit edge functions is to implement rate limiting directly within the function logic, ensuring function availability and protecting sensitive operations from excessive invocation attempts.

Can I use a service-role key to bypass user JWT authentication in edge functions?

Yes, you can use a service-role key to bypass user JWT authentication in edge functions. This dual authentication setup allows service-role bypass for cron triggers while still supporting admin user JWT verification.

How do I invoke a secure edge function from the frontend?

To invoke a secure edge function from the frontend, use an 'invokeFunction' helper method that handles the JWT token attachment and permission verification automatically for easy and secure function execution.

Why does inline JWT decoding help avoid roundtrip authentication issues in edge computing?

Inline JWT decoding helps avoid roundtrip authentication issues in edge computing by directly verifying the token within the edge function itself, eliminating the need for external authentication calls and reducing latency.