Reputation: 4337
I really getting confused with Google OAuth 2.
My requirement is not to redirect user
to google login page
which they describe in all their docs.
My requirement is that i have the python script which i want to run as cron job which can access my calendar events for read only purpose
All their docs say mentioning redircting to browser for authenticating the user but nothing is mentioned by which i can authenticate my personal account which is as simple like entering my username and password
but i have found nothing in their docs
I read this
https://developers.google.com/accounts/docs/OAuth2ServiceAccount#libraries
They told to use JWT
but they have not mentioned how to do that in any code
{"alg":"RS256","typ":"JWT"}.
{
"iss":"761326798069-r5mljlln1rd4lrbhg75efgigp36m78j5@developer.gserviceaccount.com",
"scope":"https://www.googleapis.com/auth/prediction",
"aud":"https://accounts.google.com/o/oauth2/token",
"exp":1328554385,
"iat":1328550785
}.
[signature bytes]
I am not sure just accessing my personal calendar is going to be that hard in V3 of API
Upvotes: 0
Views: 281
Reputation: 24344
I would just use foauth.org
which makes OAuth 2.0 much simpler. You could also use the requests-foauth
library which allows to interact with foauth.org
as well.
Another simple (I mean clean, concise, and pythonic) library to use is python-foauth2
, which comes with a full example using google APIs.
Some notes:
OAuth2 Service account are meant for server to server applications, meaning it should not be tied to your account (or your calendar).
For scripts, it's much better to follow the instructions for OAuth2 for installed apps; open up a browser to authorize the app / script and get a code that you can redeem for a token. The instructions for OAuth2 for devices is almost the same but provides 2 codes, one to enter in a browser and one to store on the device (or both from a computer...).
Upvotes: 1