Add support for OAuth2 scope parameter (#199)

* Add support for OAuth2 scope parameter

* Add description for OAuth2 scope parameter

* Update docs with OAuth2 scope parameter

* Make request params None if no scope
This commit is contained in:
jarik2995
2019-01-31 02:58:50 +08:00
committed by Henning Jacobs
parent 34bb4d6917
commit e265ca4d79
3 changed files with 7 additions and 1 deletions

View File

@@ -34,6 +34,7 @@ logger = logging.getLogger(__name__)
SERVER_STATUS = {'shutdown': False}
AUTHORIZE_URL = os.getenv('AUTHORIZE_URL')
APP_URL = os.getenv('APP_URL')
SCOPE = os.getenv('SCOPE')
app = Flask(__name__)
@@ -45,7 +46,8 @@ auth = OAuthRemoteAppWithRefresh(
request_token_url=None,
access_token_method='POST',
access_token_url=os.getenv('ACCESS_TOKEN_URL'),
authorize_url=AUTHORIZE_URL
authorize_url=AUTHORIZE_URL,
request_token_params={'scope': SCOPE} if SCOPE else None
)
oauth.remote_apps['auth'] = auth