From 4b377a7ca7691aecf949a6ee7b3d7169a20674a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Rychlik?= Date: Tue, 11 Dec 2012 20:33:15 +0100 Subject: [PATCH] Authorization URL can be customized --- flask_oauth.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/flask_oauth.py b/flask_oauth.py index b21105a..d583a05 100644 --- a/flask_oauth.py +++ b/flask_oauth.py @@ -320,12 +320,14 @@ def free_request_token(self): session.pop(self.name + '_oauthtok', None) session.pop(self.name + '_oauthredir', None) - def authorize(self, callback=None): + def authorize(self, callback=None, extra_params=None): """Returns a redirect response to the remote authorization URL with the signed callback given. The callback must be `None` in which case the application will most likely switch to PIN based authentication or use a remotely stored callback URL. Alternatively it's an URL on the system that has to be decorated as :meth:`authorized_handler`. + You can also pass any `extra_params` that will be added to the + authorization URL. """ if self.request_token_url: token = self.generate_request_token(callback)[0] @@ -340,6 +342,8 @@ def authorize(self, callback=None): params['redirect_uri'] = callback params['client_id'] = self.consumer_key params['response_type'] = 'code' + if extra_params: + params.update(extra_params) session[self.name + '_oauthredir'] = callback url = add_query(self.expand_url(self.authorize_url), params)