This commit is contained in:
2025-11-14 14:47:19 +00:00
parent 2a85845835
commit 46b2319e2d
199 changed files with 607543 additions and 11147 deletions
+4 -3
View File
@@ -18,13 +18,14 @@ class SupabaseBearer(HTTPBearer):
try:
token = credentials.credentials
payload = verify_supabase_token(token)
# Decode using the string-based verifier to avoid async dependency conflicts
payload = verify_supabase_jwt_str(token)
return payload
except Exception as e:
logger.error(f"Token verification failed: {str(e)}")
raise HTTPException(status_code=403, detail="Invalid token or expired token.")
def verify_supabase_token(token: str) -> dict:
def verify_supabase_jwt_str(token: str) -> dict:
"""Verify a Supabase JWT token and return its payload."""
try:
jwt_secret = os.getenv("JWT_SECRET")
@@ -63,7 +64,7 @@ def decodeSupabaseJWT(token: str) -> dict:
# Initialize the security instance
security = HTTPBearer()
async def verify_supabase_token(credentials: HTTPAuthorizationCredentials = Depends(security)):
async def verify_supabase_token_dep(credentials: HTTPAuthorizationCredentials = Depends(security)):
try:
token = credentials.credentials
# Verify token using your Supabase JWT secret