Google Connect is a simple module for connecting with google APIs via OAUTH2
Change options.client_id and options.client_secret to reflect your app
local gConnect = require("googleConnect")
If the user never used the app, it will open a WebPopUp so the user can authorize the app. The module will save the user refresh token and try to use it on all subsequent usages without presenting a webPopUp again.
gConnect.connect(callback)
On your callback function (or anytime after the callback was called, you can call google APIs using google.api(URL, METHOD, CALLBACK), for example:
google.api("https://www.googleapis.com/oauth2/v1/userinfo", "GET", function(event)
print(event.response)
end)
local gConnect = require("googleconnect")
function connectCallback(event)
if(not event.isError) then
gConnect.api("https://www.googleapis.com/oauth2/v1/userinfo", "GET", function(event)
print(event.response)
end)
end
end
gConnect.connect(connectCallback)