So I’m working on a small integration app with PHP, have installed your library and also implemented it. For the first time authentication, it works fine and also later on it works fine. What I have a problem with is the workflow needed.
After an hour when the token expires the authentication does not work anymore. I’ve noticed there is an implementation for the refresh token, have used that as well but still no luck.
Currently, my workflow is as follows:
- Print out the authentication link
- Link redirects back with a code and state parameter
- On the page if both are present I take the code and use the fetchToken() method to get the token
- I also use the refreshAccessToken() method to get the refresh token
Now this all works fine and I get retrieve data from the API. The main question that I have is how is the workflow supposed to look like, so I can get data even after an hour or at a later request. Which part should I save in my system and how should I reuse it again later on so I can successfully authenticate again?