I'm currently implementing a REST Api for a Single Page Application and Mobile App. Any 3rd party login or grant access to them is not required. I've microservices behind a gateway (all HTTPS). My current design is as follows:
POST username/password to /session. This generates two tokens, SessionToken (7 days exp), AccessToken(15 min exp). The SessionToken contains a UUID that is saved in the database (so user can see all his active sessions and blacklist if needed). Tokens are set as an HTTP Only, Secure, Same-Site Cookie.
Why AccessToken? The charm is that I only hit the database once every 15 minutes to verify that the SessionToken wasn't blacklisted. And the user_id for lookups is contained in the token.
The SessionToken is extended every time a new access token is requested, so it will only be invalid when it wasn't used for 7 days or it was blacklisted.
Basically I want sessions that do not hit the database for EVERY request. So each microservice can validate the JWT and know it is user x performing the request.
Is this an acceptable approach?