Image by Neil Turner
Results are inconclusive. Looking directly at the init code of google's client api may result in irreversable eye damage.
Just promise
me you'll load the api.
bower install --save goggles
Include this on your page
var goggles = new Goggles({
apiKey: "SOME_API_KEY",
clientId: "SOME_CLKENT_KEY"
scope: [
'https://www.googleapis.com/auth/calendar.readonly'
]
});
// Attach login to button if not automatically logged in
$("button .google").click(goggles.login)
The apiKey
allows your app to access public data.
The clientId
is the id that the user is authorizing to access their public data.
The scope
is a set of permissions that the user is granting to the clientId
.
// google api promise (goggles)
// returns the `gapi`
goggles.then(function(gapi){
gapi.client.request({
// request params
}).execute(function(){});
});
then(fn)
Where fn is a function of signature function (googleApi)
login()
Method to prompt the user to allow oauth access.
Note - This must be done syncronously on a button click to prevent the popup from being blocked
Specs please.
The MIT License (MIT)
Copyright (c) 2014 Will O'Brien