def request_access_token(self, auth_code):
    if (self._state != auth_code.state):
        raise ValueError(f'Unexpected state parameter [{auth_code.state}] passed')
    self._params.update({'code': auth_code.code, 'code_verifier': self._code_verifier, 'grant_type': 'authorization_code'})
    resp = _requests.post(url=self._token_endpoint, data=self._params, headers=self._headers, allow_redirects=False)
    if (resp.status_code != _StatusCodes.OK):
        raise Exception('Failed to request access token with response: [{}] {}'.format(resp.status_code, resp.content))
    self._initialize_credentials(resp)
def request_access_token(self, auth_code):
    if (self._state != auth_code.state):
        raise ValueError(f'Unexpected state parameter [{auth_code.state}] passed')
    self._params.update({'code': auth_code.code, 'code_verifier': self._code_verifier, 'grant_type': 'authorization_code'})
    resp = _requests.post(url=self._token_endpoint, data=self._params, headers=self._headers, allow_redirects=False)
    if (resp.status_code != _StatusCodes.OK):
        raise Exception('Failed to request access token with response: [{}] {}'.format(resp.status_code, resp.content))
    self._initialize_credentials(resp)