I have been trying to access the Google API with Wappler, and have not really found it to be doing quite what I would expect.
Take an example of using the gmail.api with regular old PHP, which Google pretty much provides the libraries to install all the supporting methods, classes and functions.
In PHP your app would run, it would first look for a file on the webserver called token.json
then read the contents of that file, checking the created timestamp against the expires in time and if expired, use the refresh_token
to get a newer access_token
This file looks like this but with far far longer codes for access and refresh.
{"access_token":"ya29.a0Adw1xeXt???????","expires_in":3599,"refresh_token":"1\/\/03G7pgZAUTLBXCgYIARA??????","scope":"https:\/\/www.googleapis.com\/auth\/gmail.readonly","token_type":"Bearer","created":1585475522}
If however the file does not exist then it creates a new one for you and uses the access_token
part of that to make sure the person does not have to keep authenticating their google account.
I have tried to replicate the functionality with little success, as I can not seem to get the refresh_token
from Google firstly and secondly I can not find a way to write the data I do have into token.json
file. I only have options for csv or xml file output which is not quite producing the results I am needing.
I also know that in my next step if I do get the export working as needed, I will also need to figure out how to read the contents of the .json file later on to make calculations against the created timestamp and the expires_in field, which I have not got to as yet but do not think it would be possible.
This Auth as far as I am aware is the same for all the APIs in the Google product offering, so I assume I am just overthinking things or something as I have not read of other people experiencing the same issue as yet. @patrick maybe you could try fix my thinking here.
Last updated: