Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

authenticate_request fetches the JWKS repeatedly #54

Closed
diwu-sf opened this issue Nov 8, 2024 · 2 comments
Closed

authenticate_request fetches the JWKS repeatedly #54

diwu-sf opened this issue Nov 8, 2024 · 2 comments

Comments

@diwu-sf
Copy link

diwu-sf commented Nov 8, 2024

authenticate_request seem to fetch the jwks repeatedly (function fetch_jwks) to find the right public key.

is it possible to have this cache the public key instead of doing network calls on every authenticate request call?
We use authenticate_request as part of our authentication middleware so every API call will trigger this.

@kdenz
Copy link

kdenz commented Nov 10, 2024

        # Authenticate request using Clerk SDK
        auth_state: RequestState = clerk_client.authenticate_request(
            httpx_request,
            AuthenticateRequestOptions(
                jwt_key=settings.CLERK_JWT_KEY,
            ),
        )

Providing JWT key upfront helps for me. Can be found in API Keys page of the Clerk dashboard

image

@speakeasybot
Copy link
Collaborator

Thanks for the solution, @kdenz !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants