theprnce / google-api-python-client

Automatically exported from code.google.com/p/google-api-python-client
Other
0 stars 0 forks source link

GAE decorators don't support a custom name for `credentials` in CredentialsModel #284

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Choose OAuth2Decorator or OAuth2DecoratorFromClientSecrets
2. Apply it to your handler
3. A CredentialsModel will be created, with one property named `credentials` 
which cannot be renamed/customized.

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

I have an app with users requiring two different levels of access to API 
scopes. They all require ['https://www.googleapis.com/auth/userinfo.email', 
'https://www.googleapis.com/auth/userinfo.profile'] for login purposes. Only a 
subset of them require access to other scopes, let's say 
https://www.googleapis.com/auth/drive.

I want to be able to have a `login_credentials` property and then a 
`drive_credentials` for drive.

I don't want to ask all users all scopes, it's bad user experience (request 
permissions I won't use). I want to be able to customize that field unless you 
can recommend a better approach.

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

Latest version of the libraries for GAE.

Please provide any additional information below.

This is probably more of an enhancement than a bug.

Original issue reported on code.google.com by silicala...@gmail.com on 20 Jun 2013 at 9:53

GoogleCodeExporter commented 9 years ago
I would recommend keeping a separate scopes list and upgrading users if they 
need both.

Original comment by dhermes@google.com on 20 Jun 2013 at 10:05

GoogleCodeExporter commented 9 years ago
As for a custom name, we have supported that since
https://code.google.com/p/google-api-python-client/source/detail?r=07913911fbd18
65ee3d4393a3c57e0aaefd1aad5

Do you have any remaining issues?

Original comment by dhermes@google.com on 20 Jun 2013 at 10:06

GoogleCodeExporter commented 9 years ago
Thanks Danny, I totally missed the protected kwargs way. That should do the 
trick.

Original comment by silicala...@gmail.com on 21 Jun 2013 at 12:03

GoogleCodeExporter commented 9 years ago
Working as Intended

Original comment by dhermes@google.com on 21 Jun 2013 at 12:05