trueutkarsh / google-drive-sdk-samples

Automatically exported from code.google.com/p/google-drive-sdk-samples
0 stars 0 forks source link

Python example doesn't grab refresh token #22

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Run python Sample
2. Don't reauth for a while
3. Try to save or open a drive file

What is the expected output? What do you see instead?

I expect to be able to save, instead this error is returned:

HttpError: <HttpError 401 when requesting 
https://www.googleapis.com/oauth2/v2/userinfo?alt=json returned "Invalid 
Credentials">

What version of the product are you using? On what operating system?

OS X Lion, Python 2.7

Please provide any additional information below.

The problem is that on line 993 of lib/oauth2client/client.py, the default 
params do not contain 'approval_prompt': 'force'. Without this, the refresh 
token is never returned and the app times out quickly.

Original issue reported on code.google.com by m...@codiqa.com on 20 Jul 2012 at 7:42

GoogleCodeExporter commented 9 years ago
Woops, can't edit. Here's more information:

self.params should be:

    self.params = {
        'access_type': 'offline',
        'approval_prompt': 'force'
        }

Original comment by m...@codiqa.com on 20 Jul 2012 at 7:43

GoogleCodeExporter commented 9 years ago
I don't think this is a bug because "online" access is how they want you to 
request access by default for web apps. However, for desktop/phone or web apps 
that you want to leave open for more than hour then re-authentication every 
hour sucks.

If Google Docs asked for authentication every hour then it would be a total 
piece of crap.  So as with other Google Drive permissions you either gotta have 
a crappy app or ask for everything.  So my request would be to just better 
document this and also in the future provide less scary permissions, something 
in between do nothing and do everything.

Original comment by Paul.M.B...@gmail.com on 9 Dec 2012 at 3:55