def get_access_token(self):
self.clean_error()<EOL>try:<EOL><INDENT>url = self.get_url(Constants.TOKEN_REQUEST_URL)<EOL>data = {<EOL>'<STR_LIT>': '<STR_LIT>'<EOL>}<EOL>headers = self.get_authorized_headers(bearer=False)<EOL>response = requests.post(url, headers=headers, json=data)<EOL>if response.status_code == <NUM_LIT:200>:<EOL><INDENT>data = response.json()<EOL>if '<STR_LIT:status>' in data:<EOL><INDENT>self.error = str(data['<STR_LIT:status>']['<STR_LIT:code>'])<EOL>self.error_description = self.extract_error_message_from_response(response)<EOL><DEDENT>else:<EOL><INDENT>token = OneLoginToken(response.json())<EOL>self.access_token = token.access_token<EOL>self.refresh_token = token.refresh_token<EOL>self.expiration = token.created_at + datetime.timedelta(seconds=token.expires_in)<EOL>return token<EOL><DEDENT><DEDENT>else:<EOL><INDENT>self.error = str(response.status_code)<EOL>self.error_description = self.extract_error_message_from_response(response)<EOL><DEDENT><DEDENT>except Exception as e:<EOL><INDENT>self.error = <NUM_LIT><EOL>self.error_description = e.args[<NUM_LIT:0>]<EOL><DEDENT>
Generates an access token and refresh token that you may use to
call Onelogin's API methods.

Returns the generated OAuth Token info
:return: OAuth Token info
:rtype: OneLoginToken

See https://developers.onelogin.com/api-docs/1/oauth20-tokens/generate-tokens Generate Tokens documentation.