Open zhetao1116 opened 1 month ago
Hello @zhetao1116 thanks for using the SDK and for raising this.
This error occurs when you have an invalid or expired token.
You can get a valid token using Auth flow of your choice, check the samples here, under authentication samples:
https://github.com/microsoftgraph/msgraph-sdk-python/tree/main/docs
You can also build your own way of getting the token following https://learn.microsoft.com/en-us/python/api/overview/azure/identity-readme?view=azure-python
HI @shemogumbe ! Thanks for reply.
This error occurs when you have an invalid or expired token.
Yeah, but we want to know this type of error as we expect the sdk client to return InvalidTokenException instead of the unrelated ValueError: Unable to parse claims from response. How could we get that?
bump up
+1 for @zhetao1116 . I am in the same situation with you, using the access token directly. I also expect more specific exception than ValueError to be raised when the token in expired.
Describe the bug
I am facing the same issue although I am invoking the public API and it happens when the token is invalid or expired. My code for Graph Client. I initialize it with OAuth token directly.
Any idea how could I fix it to get the error response? A similar issue thread which has the exactly same error which hasn't been fully resolved: https://github.com/microsoftgraph/msgraph-sdk-python/issues/672 The response from MSFT:
Expected behavior
The ODataError/APIError exception should be raised.
How to reproduce
Invoke a public API with an invalid/expired oauth token.
SDK Version
1.1.0
Latest version known to work for scenario above?
No response
Known Workarounds
No response
Debug output
Click to expand log
```Configuration
No response
Other information
No response