Comment on How to store user's access tokens/API keys without hashing them?

DeprecatedCompatV2@programming.dev ⁨1⁩ ⁨year⁩ ago

Here’s a simple approach:

Initial request -> server looks for Authorization header, falls back to X-Auth header -> generates JWT and sends back to client in Authorization header (or whatever makes sense)

Subsequent request -> server looks for Authorization header -> checks JWT against revocation database/table and that it isn’t expired

Subsequent request with expired token -> server returns 401, client retries using X-Auth header -> server sends back JWT on Authorization header -> client updates locally-stored JWT for future requests

There are probably ways to make this more standard or optimal, but this is a simple approach.

source
Sort:hotnewtop