Skip to content

Commit

Permalink
Return refresh token only if we issue one
Browse files Browse the repository at this point in the history
According to https://tools.ietf.org/html/rfc6749#section-5.1,
refresh_token parameter is OPTIONAL, so do not return one with
null value in case we don't issue a refresh token
  • Loading branch information
jkakavas committed Oct 12, 2017
1 parent cf57877 commit f696187
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/pyop/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,9 @@ def _do_code_exchange(self, request, # type: Dict[str, str]

access_token = self.authz_state.exchange_code_for_token(token_request['code'])
self._add_access_token_to_response(response, access_token)
response['refresh_token'] = self.authz_state.create_refresh_token(access_token.value)
refresh_token = self.authz_state.create_refresh_token(access_token.value)
if refresh_token is not None:
response['refresh_token'] = refresh_token

if extra_id_token_claims is None:
extra_id_token_claims = {}
Expand Down

0 comments on commit f696187

Please sign in to comment.