How to persist and update oauth 2.0 Access Token from Google?

Asked

Viewed 380 times

0

I have a Google Analytics account and need Token Access to make some requests that return data from this account. Whenever I use oauth to authenticate it works, however, when I change page the data of my Tokens vanish. I have already stored them in a $_SESSION (php) to move to another page, and it works normally, but after 1 hour Access Token expires and does not work anymore, and also does not update automatically even with Refresh Token. Can anyone help me? I’ve been with this problem for a long time without being able to solve it.

1 answer

0

I managed to solve my problem. I found this article on the internet: https://ctrlq.org/code/20363-google-api-php-oauth2-example The code presented there causes the data to be saved in a file. txt (you can choose to save to the database as well) and all data is still saved and checking if the token has expired.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.