summaryrefslogtreecommitdiff
path: root/oauthlib/oauth2/rfc6749/grant_types
diff options
context:
space:
mode:
authorHiroki KIYOHARA <hirokiky@gmail.com>2015-09-29 13:04:59 +0900
committerHiroki KIYOHARA <hirokiky@gmail.com>2015-09-29 13:04:59 +0900
commitc1b24120bb627eb471dd99ea409c934fe942c836 (patch)
treeb396c00b8de16fc05819a3ecbe2b7019ee60d527 /oauthlib/oauth2/rfc6749/grant_types
parent37bea19049497c820891c2ccbcce9c4b9dc0d7b9 (diff)
downloadoauthlib-c1b24120bb627eb471dd99ea409c934fe942c836.tar.gz
Added a kwarg to set wether refresh token will be created or not
Diffstat (limited to 'oauthlib/oauth2/rfc6749/grant_types')
-rw-r--r--oauthlib/oauth2/rfc6749/grant_types/authorization_code.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/oauthlib/oauth2/rfc6749/grant_types/authorization_code.py b/oauthlib/oauth2/rfc6749/grant_types/authorization_code.py
index 658f5ad..31f06fc 100644
--- a/oauthlib/oauth2/rfc6749/grant_types/authorization_code.py
+++ b/oauthlib/oauth2/rfc6749/grant_types/authorization_code.py
@@ -95,8 +95,9 @@ class AuthorizationCodeGrant(GrantTypeBase):
.. _`Authorization Code Grant`: http://tools.ietf.org/html/rfc6749#section-4.1
"""
- def __init__(self, request_validator=None):
+ def __init__(self, request_validator=None, refresh_token=True):
self.request_validator = request_validator or RequestValidator()
+ self.refresh_token = refresh_token
def create_authorization_code(self, request):
"""Generates an authorization grant represented as a dictionary."""
@@ -237,7 +238,7 @@ class AuthorizationCodeGrant(GrantTypeBase):
log.debug('Client error during validation of %r. %r.', request, e)
return headers, e.json, e.status_code
- token = token_handler.create_token(request, refresh_token=True)
+ token = token_handler.create_token(request, refresh_token=self.refresh_token)
self.request_validator.invalidate_authorization_code(
request.client_id, request.code, request)
return headers, json.dumps(token), 200