microsoft / microsoft/azure-devops-python-api
AzureDevOpsAuthenticationError: The requested resource requires user authentication: https://dev.azure.com/myorg/_apis
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 684
- Forks
- 218
- Avg merge
- 8d 10h
- Merged PRs (30d)
- 1
Description
I followed the sample code:
credentials = BasicAuthentication(username=user, password=pat)
self.connection = Connection(base_url="https://dev.azure.com/myorg/", creds=credentials)
testClient = self.connection.clients.get_core_client()
But I get exception. Did I miss something?
testClient = self.connection.clients.get_core_client()
File "/Users/runner/hostedtoolcache/Python/3.10.0/x64/lib/python3.10/site-packages/azure/devops/released/client_factory.py", line 44, in get_core_client
return self._connection.get_client('azure.devops.released.core.core_client.CoreClient')
File "/Users/runner/hostedtoolcache/Python/3.10.0/x64/lib/python3.10/site-packages/azure/devops/connection.py", line 45, in get_client
self._client_cache[client_type] = self._get_client_instance(client_class)
File "/Users/runner/hostedtoolcache/Python/3.10.0/x64/lib/python3.10/site-packages/azure/devops/connection.py", line 58, in _get_client_instance
url = self._get_url_for_client_instance(client_class)
File "/Users/runner/hostedtoolcache/Python/3.10.0/x64/lib/python3.10/site-packages/azure/devops/connection.py", line 70, in _get_url_for_client_instance
resource_areas = self._get_resource_areas()
File "/Users/runner/hostedtoolcache/Python/3.10.0/x64/lib/python3.10/site-packages/azure/devops/connection.py", line 120, in _get_resource_areas
self._resource_areas = location_client.get_resource_areas()
File "/Users/runner/hostedtoolcache/Python/3.10.0/x64/lib/python3.10/site-packages/azure/devops/v5_1/location/location_client.py", line 104, in get_resource_areas
response = self._send(http_method='GET',
File "/Users/runner/hostedtoolcache/Python/3.10.0/x64/lib/python3.10/site-packages/azure/devops/client.py", line 74, in _send
request = self._create_request_message(http_method=http_method,
File "/Users/runner/hostedtoolcache/Python/3.10.0/x64/lib/python3.10/site-packages/azure/devops/client.py", line 119, in _create_request_message
location = self._get_organization_resource_location(location_id)
File "/Users/runner/hostedtoolcache/Python/3.10.0/x64/lib/python3.10/site-packages/azure/devops/client.py", line 160, in _get_organization_resource_location
return self._get_resource_location(self.normalized_url, location_id)
File "/Users/runner/hostedtoolcache/Python/3.10.0/x64/lib/python3.10/site-packages/azure/devops/client.py", line 172, in _get_resource_location
Client._locations_cache[url] = self._get_resource_locations(url, all_host_types=False)
File "/Users/runner/hostedtoolcache/Python/3.10.0/x64/lib/python3.10/site-packages/azure/devops/client.py", line 208, in _get_resource_locations
response = self._send_request(request, headers=headers)
File "/Users/runner/hostedtoolcache/Python/3.10.0/x64/lib/python3.10/site-packages/azure/devops/client.py", line 68, in _send_request
self._handle_error(request, response)
File "/Users/runner/hostedtoolcache/Python/3.10.0/x64/lib/python3.10/site-packages/azure/devops/client.py", line 290, in _handle_error
raise AzureDevOpsAuthenticationError(full_message_format.format(error_message=error_message,
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Connection(...) and BasicAuthentication sample, then trace get_core_client through azure/devops/connection.py and azure/devops/client.py to the resource-area request shown in the stack trace. Reproduce the authentication failure and identify the missing configuration or endpoint detail; done means the sample authenticates successfully or the required correction is documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, python
- Domain
- api, authentication
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100