Example #1
0
def __token_grant_by_refresh_token(apikey):
    refresh_token = __check_request_required_var('refresh_token')

    token = ApiToken.get_by_refresh_token(refresh_token)
    if not token:
        raise InvalidRequest(err.invalid_refresh_token, ext=refresh_token)

    if datetime.now() > token.refresh_expire_time:
        raise InvalidRequest(err.refresh_token_has_expired, ext=refresh_token)

    new_token = token.refresh()
    return json.dumps(new_token.token_dict())
Example #2
0
def __token_grant_by_refresh_token(apikey):
    refresh_token = __check_request_required_var('refresh_token')

    token = ApiToken.get_by_refresh_token(refresh_token)
    if not token:
        raise InvalidRequest(err.invalid_refresh_token, ext=refresh_token)

    if datetime.now() > token.refresh_expire_time:
        raise InvalidRequest(err.refresh_token_has_expired, ext=refresh_token)

    new_token = token.refresh()
    return json.dumps(new_token.token_dict())
Example #3
0
 def test_get_token_by_refresh_token(self):
     token = self._add_api_token()
     target_token = ApiToken.get_by_refresh_token(token.refresh_token)
     eq_(token, target_token)
Example #4
0
 def test_get_token_by_refresh_token(self):
     token = self._add_api_token()
     target_token = ApiToken.get_by_refresh_token(token.refresh_token)
     eq_(token, target_token)