[ ENH ] Provide authentication failure detail when credentials are provided directly to a Service Class. #501
Labels
authentication
Issues or questions regarding authentication
enhancement 🌟
New feature or request
SDK usage
General SDK usage issues and questions
Describe the issue
Service Class instantiation does not provide an API response, even though a token is generated. On token generation failure, the failure reason is swallowed.
To Reproduce
Create an instance of any Service Class using invalid credentials. You are not provided an immediate response, so any failure reason is hidden. Follow up requests to the API will produce an
invalid bearer token
error.Expected behavior
When the token generation fails, provide a place within the class to retrieve the reason.
Environment (please complete the following information):
Additional context
Discussed in #500
Originally posted by morcef January 3, 2022
Hi,
I am new to this SDK, and I have been starting with using the Detects Service Class (https://falconpy.io/Service-Collections/Detects.html). In the beginning the Detects authenticated() method would return False, and I was having trouble finding the reason.
This seems to be due to the fact that the Service Class will throw away any response that does not have status code 201, and include a token (
falconpy/src/falconpy/_service_class.py
Lines 142 to 156 in 5adb86c
At this point there was no clear way for me to figure out why this was failing, other than accessing the Detects' auth_object, and executing its token() method a second time to get the actual response. However, my IDE is giving me the following warning when accessing the auth_object: Unresolved attribute reference 'auth_object' for class 'Detects'.
The text was updated successfully, but these errors were encountered: