

def create_token_response(self, request, token_handler):
    'Return token or error in json format.\n\n        If the access token request is valid and authorized, the\n        authorization server issues an access token and optional refresh\n        token as described in `Section 5.1`_.  If the request failed client\n        authentication or is invalid, the authorization server returns an\n        error response as described in `Section 5.2`_.\n\n        .. _`Section 5.1`: http://tools.ietf.org/html/rfc6749#section-5.1\n        .. _`Section 5.2`: http://tools.ietf.org/html/rfc6749#section-5.2\n        '
    headers = {
        'Content-Type': 'application/json',
        'Cache-Control': 'no-store',
        'Pragma': 'no-cache',
    }
    try:
        if self.request_validator.client_authentication_required(request):
            log.debug('Authenticating client, %r.', request)
            if (not self.request_validator.authenticate_client(request)):
                log.debug('Client authentication failed, %r.', request)
                raise errors.InvalidClientError(request=request)
        elif (not self.request_validator.authenticate_client_id(request.client_id, request)):
            log.debug('Client authentication failed, %r.', request)
            raise errors.InvalidClientError(request=request)
        log.debug('Validating access token request, %r.', request)
        self.validate_token_request(request)
    except errors.OAuth2Error as e:
        log.debug('Client error in token request, %s.', e)
        return (request, e.json, e.status_code)
    token = token_handler.create_token(request, self.refresh_token)
    log.debug('Issuing token %r to client id %r (%r) and username %s.', token, request.client_id, request.client, request.username)
    return (headers, json.dumps(token), 200)

dataset/ETHPy150Open idan/oauthlib/oauthlib/oauth2/rfc6749/grant_types/resource_owner_password_credentials.py ResourceOwnerPasswordCredentialsGrant.create_token_response/VarMisuse@174/485 `headers`->`request`