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

Add caching functionality/pathways for token validation #1194

Open
MatthewAry opened this issue Dec 20, 2024 · 0 comments
Open

Add caching functionality/pathways for token validation #1194

MatthewAry opened this issue Dec 20, 2024 · 0 comments

Comments

@MatthewAry
Copy link

Every time we validate a session token, it makes a request to WorkOS's infra to get the same value from their systems to validate the token. On our end, we see each validation operation adds ~200ms to each request that performs a token check. Usually the key used for authenticity verification changes very infrequently so it's something that can be cached. The SDK could cache the key in a singleton on the server and use that and validate using the cached key optimistically. If the authenticity check fails, then it can call the endpoint to see if the verification key changed at WorkOS as a fallback, if it turns out to be a cache miss, then check the token and at the same time update the cache.

This should improve perf greatly on our end.

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

No branches or pull requests

1 participant