I’m currently trying to think through the best way to temporarily store Bearer tokens in Trellis. I used environment variables with ansible vault to store my initial authentication to get the bearer token, but now I need a way to store these bearer tokens for each user.
I only want to grab another token if the users current one is expired. If the API responds with a 1631 error then it will loop back to grab another token and continue on with the request. The token only lasts 15 minutes but I’d still like to lower the amount of authentication requests on the server.
Anyone have any tips on how to go about this?
*btw, this is all happening through an ajax call on a jQuery event and then I’m using wp_remote_get to perform the API call in the php file. *