'Best practice: Storing Authentication Information in Backend

I am developing a FastAI backend which uses a 3rd party authentication. The performance of this authentication method is horrible. Every token validation takes multiple seconds.

Therefore, I am considering to set up a backend session information system which stores every token + validity which has been checked once and validate a token which is received from the frontend in my backend environment based on the cookies.

I don't see any risk in, but at the same time this seems to be quite off from a best practice. I would appreciate any advice if such a setup is reasonable?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source