the authenticate_request method is dynamically added to the main Clerk class inside jwks_helpers/__init__.py file
if a secret_key is not passed to the AuthenticateRequestOptions object, retrieving it from the security.bearer_auth value stored in the SDK instance will be attempted
Limitations
the added helper functions are only applicable for Backend APIs, afterSignInUrl/afterSignUpUrl options are not implemented
multi-domain setup (isSatellite, proxyUrl, signInUrl, signUpUrl) is not implemented
caching is not covered by this PR and skipJwksCache option is not made available
Tests
To run tests (poetry run pytest) the following environment variables should be set (see tests/conftest.py for more details):
CLERK_SECRET_KEY: The Clerk secret key from the API Keys page in the Clerk Dashboard.
CLERK_SESSION_TOKEN: The session token to be tested.
CLERK_JWT_KEY: The PEM public key from Clerk Dashboard (networkless verification only)
This PR adds authenticate_request and verify_token helper functions.
Notes
jwks_helpers/
module is .genignoredauthenticate_request
method is dynamically added to the mainClerk
class insidejwks_helpers/__init__.py
filesecret_key
is not passed to theAuthenticateRequestOptions
object, retrieving it from thesecurity.bearer_auth
value stored in the SDK instance will be attemptedLimitations
afterSignInUrl
/afterSignUpUrl
options are not implementedisSatellite
,proxyUrl
,signInUrl
,signUpUrl
) is not implementedskipJwksCache
option is not made availableTests
To run tests (
poetry run pytest
) the following environment variables should be set (seetests/conftest.py
for more details):CLERK_SECRET_KEY
: The Clerk secret key from the API Keys page in the Clerk Dashboard.CLERK_SESSION_TOKEN
: The session token to be tested.CLERK_JWT_KEY
: The PEM public key from Clerk Dashboard (networkless verification only)