question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Ability to store the token in a caching tool

See original GitHub issue

Ability to store the token in a caching tool (e.g: Redis with TTL keys) to prevent checking with azure on every request

It would be great to have an ability in which we can store the user token in a caching tool like Redis and set a TTL for it so that it will expire after a while (Probably set the exact time azure would keep the session for the token), so it prevents sending request to azure AD to check the token on each request. I hope It’s clear what I’m asking.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
alexjoligcommented, Nov 15, 2021

Thanks again for your kind reply 😃

1reaction
JonasKscommented, Nov 15, 2021

Hi!

  1. The public key(s) can be found at the url given in the response under the jwks key. See line 86.

  2. Expiry is checked using the python-jose library. It is configured to fail for expired tokens. The behavior is also tested here. You either have disabled auth (misconfiguration), or your token is actually not expired.

  3. No, the backend only cares about access tokens. Refreshing etc. should be done by the client.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Caching tokens - Amazon Cognito - AWS Documentation
In this solution, you define a cache in your API to store a separate access token for each combination of OAuth scopes and...
Read more >
Acquire and cache tokens with Microsoft Authentication ...
MSAL maintains a token cache (or two caches for confidential client applications) and caches a token after it's been acquired. In many cases, ......
Read more >
Best Practices - Box Developer Documentation
Because fetching new tokens is expensive, we recommend using a token cache to prevent unnecessary requests. After retrieving a token, store it in...
Read more >
Caching Management API Access Tokens in Login Action
Auth0 recently announced the ability to cache tokens within our extensibility solution, Actions. This has been a much requested feature that ...
Read more >
Caching strategies for authentication | by Ted Spence
The stumbling block is that verifying an authentication token is slow on purpose ... If you are able to, I strongly encourage you...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found