OAuth2Decorator should take and pass kwargs to underlying Flow.
Reviewed in http://codereview.appspot.com/5522049/
diff --git a/oauth2client/appengine.py b/oauth2client/appengine.py
index f1599bb..723de8a 100644
--- a/oauth2client/appengine.py
+++ b/oauth2client/appengine.py
@@ -308,7 +308,7 @@
def __init__(self, client_id, client_secret, scope,
auth_uri='https://accounts.google.com/o/oauth2/auth',
token_uri='https://accounts.google.com/o/oauth2/token',
- message=None):
+ message=None, **kwargs):
"""Constructor for OAuth2Decorator
@@ -324,9 +324,11 @@
message: Message to display if there are problems with the OAuth 2.0
configuration. The message may contain HTML and will be presented on the
web interface for any method that uses the decorator.
+ **kwargs: dict, Keyword arguments are be passed along as kwargs to the
+ OAuth2WebServerFlow constructor.
"""
self.flow = OAuth2WebServerFlow(client_id, client_secret, scope, None,
- auth_uri, token_uri)
+ auth_uri, token_uri, **kwargs)
self.credentials = None
self._request_handler = None
self._message = message
diff --git a/tests/test_oauth2client_appengine.py b/tests/test_oauth2client_appengine.py
index ca9d940..4ab4f03 100644
--- a/tests/test_oauth2client_appengine.py
+++ b/tests/test_oauth2client_appengine.py
@@ -236,5 +236,16 @@
self.assertEqual('foo_access_token',
self.decorator.credentials.access_token)
+
+ def test_kwargs_are_passed_to_underlying_flow(self):
+ decorator = OAuth2Decorator(client_id='foo_client_id',
+ client_secret='foo_client_secret',
+ scope=['foo_scope', 'bar_scope'],
+ access_type='offline',
+ approval_prompt='force')
+ self.assertEqual('offline', decorator.flow.params['access_type'])
+ self.assertEqual('force', decorator.flow.params['approval_prompt'])
+
+
if __name__ == '__main__':
unittest.main()