Skip to content

Commit 452b9d2

Browse files
feat: Check if token is a JWT
1 parent a022e59 commit 452b9d2

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

supabase_functions/_async/functions_client.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from httpx import HTTPError, Response
44

55
from ..errors import FunctionsHttpError, FunctionsRelayError
6-
from ..utils import AsyncClient, is_http_url, is_valid_str_arg
6+
from ..utils import AsyncClient, is_http_url, is_valid_jwt, is_valid_str_arg
77
from ..version import __version__
88

99

@@ -60,6 +60,9 @@ def set_auth(self, token: str) -> None:
6060
the new jwt token sent in the authorization header
6161
"""
6262

63+
if not is_valid_jwt(token):
64+
ValueError("token must be a valid JWT authorization token string.")
65+
6366
self.headers["Authorization"] = f"Bearer {token}"
6467

6568
async def invoke(

0 commit comments

Comments
 (0)