Closed sayerbartlett closed 1 year ago
I can't log a user out with log_user_out()
From my tests, it appears to be a JSONDecodeError exception being raised but I'm not sure why.
JSONDecodeError
>>> onelogin_client.error_description 'Expecting value: line 1 column 1 (char 0)'
>>> onelogin_client = OneLoginClient(client_id, client_secret) >>> >>> onelogin_client.get_access_token() <onelogin.api.models.onelogin_token.OneLoginToken object at 0x10e319970> >>> >>> query_parameters = {"email": "aaatestuserbob@eou.edu"} >>> users = onelogin_client.get_users(query_parameters) >>> >>> print(users[0]) User : {'id': 179124057, 'external_id': None, 'email': 'aaatestuserbob@eou.edu', 'username': 'aaatestuserbob@eou.edu', 'firstname': 'Bobby', 'lastname': 'Lasterson', 'distinguished_name': 'redacted', 'phone': None, 'company': '', 'department': '', 'title': '', 'status': 1, 'member_of': '', 'samaccountname': 'aaatestuserbob', 'userprincipalname': '', 'group_id': 442079, 'role_ids': [], 'custom_attributes': {}, 'openid_name': '', 'locale_code': '', 'comment': '', 'directory_id': 50400, 'manager_ad_id': None, 'trusted_idp_id': None, 'manager_user_id': None, 'activated_at': datetime.datetime(2022, 6, 3, 18, 9, 21, 159000, tzinfo=tzutc()), 'created_at': datetime.datetime(2022, 6, 3, 18, 9, 21, 164000, tzinfo=tzutc()), 'updated_at': datetime.datetime(2022, 6, 10, 21, 14, 31, 835000, tzinfo=tzutc()), 'password_changed_at': datetime.datetime(2022, 6, 3, 18, 9, 21, 102000, tzinfo=tzutc()), 'invitation_sent_at': None, 'invalid_login_attempts': 0, 'last_login': datetime.datetime(2022, 6, 10, 21, 14, 31, 580000, tzinfo=tzutc()), 'locked_until': None, 'state': 1} >>> >>> id = users[0].id >>> >>> print(id) 179124057 >>> >>> onelogin_client.log_user_out(id) False >>> >>> onelogin_client.error 500 >>> >>> onelogin_client.error_description 'Expecting value: line 1 column 1 (char 0)' >>> >>> onelogin_client.error_attribute >>> >>> >>> >>> print(onelogin_client.get_access_token()) OneLoginToken : {'access_token': 'redacted_access_token', 'refresh_token': 'redacted_refresh_token', 'account_id': redacted_account_id, 'token_type': 'bearer', 'created_at': datetime.datetime(2022, 6, 13, 15, 4, 33, 753000, tzinfo=tzutc()), 'expires_in': 36000} >>>
Using the same access token with CURL works:
➜ ~ curl 'https://api.us.onelogin.com/api/1/users/179124057/logout' \ -X PUT \ -H "Authorization: bearer: redacted_access_token" {"status":{"error":false,"code":200,"type":"success","message":"Success"}}% ➜ ~
Can you try using the beta release https://github.com/onelogin/onelogin-python-sdk/releases/tag/3.1.1
I don't know if this ticket is still active.
Closing for inactivity. Please reopen if issue persists
I can't log a user out with log_user_out()
From my tests, it appears to be a
JSONDecodeError
exception being raised but I'm not sure why.Full Test
Using the same access token with CURL works: