-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"ValueError: Unable to parse claims from response" on get() #672
Comments
Hello, to be able to understand the issue,
My suggestions
Note but worked fine with default authority, and default scope in public cloud: No error here: redential = ClientSecretCredential(
auth['tenant_id'],
client_id=auth['clientId'],
client_secret=auth['clientSecret'],
authority=os.getenv('authority'),
)
)
scopes = ['https://graph.microsoft.com/.default']
client = GraphServiceClient(credentials=credential, scopes=scopes)
print(client.request_adapter)
async def get_users():
try:
users = await client.users.get() # <--- Error on this line
for user in users.value:
print(f"User: {user.display_name} {user.id}")
except APIError as e:
print(f"Error: {e}") Having only replaced |
making these changes gives back a different error:
Here's the full traceback:
|
I have the exact same issue, the adapter always get's set to the host: graph.microsoft.com even though the authority is set up with a token for US_GOV?? Setup ->
Debug ->
Error ->
|
Worked it out, you need to set the adapter base_url before passing it to the GraphServiceClient adapter = GraphRequestAdapter(auth_provider=auth_provider, client=http_client)
adapter.base_url = 'https://graph.microsoft.us/v1.0'
self.client = GraphServiceClient(request_adapter=adapter, scopes=self.scopes) |
Moving these two discussions as it may help someone facing a similar issue |
I'm running into this same exact issue. Python version I have a The class:
Traceback:
I've tried what @deanevs recommended but no dice, any advice would be super. Thanks in advance. |
Hi @shemogumbe ! I am facing the same issue although I am invoking the public API and it happens when the token is invalid or expired.
I also tried @deanevs approach but it doesn't work unfortunatedly. Any idea how could I fix it to get the error response? |
Hello!
Trying to make any .get() call from my GraphServiceClient results in the following error:
Some context:
This is in virtalenv running
python==3.11.6
and
msgraph-sdk==1.2.0
(but I received the same error on version1.3.0
as well, tried downgrading to see if it resolved, it did not)the code I'm running is fairly simple:
I am running this in a jupyter notebook, but running in IPython leads to same result. Same result when running in a script and calling like this as well:
I'm guessing it's likely an issue with my client setup since I can't seem to find anyone else having this issue. But not sure how else to set it up, I can confirm that my tenant and client information is correct. Maybe it's an issue in how I have it set up to hit AZURE_GOVERNMENT?
Thanks in advance!
The text was updated successfully, but these errors were encountered: