azure-devops-python-api icon indicating copy to clipboard operation
azure-devops-python-api copied to clipboard

BasicAuthentication with PAT not working for contributions client

Open RamirezAmayaS opened this issue 5 years ago • 6 comments

I am getting an AzureDevOpsAuthenticationError when trying to get a contributions client. Is there any way I can access this resource using a PAT?

credentials = BasicAuthentication(' ', personal_access_token)
connection = Connection(base_url=organization_url, creds=credentials)
contributions_client = connection.clients_v6_0.get_contributions_client()

azure.devops.exceptions.AzureDevOpsAuthenticationError: The requested resource requires user authentication: https://app.vssps.visualstudio.com/_apis

RamirezAmayaS avatar Aug 27 '20 23:08 RamirezAmayaS

When you generated your PAT, did you choose Full access?

Screen Shot 2020-08-28 at 12 18 57 PM

In general its best to scope your PAT, but for some APIs, I believe you need Full access. I'm not sure about this one. Its a question you could ask in the feedback section on the REST doc site.

tedchamb avatar Aug 28 '20 16:08 tedchamb

Yes Captura de Pantalla 2020-08-28 a la(s) 11 19 02 a  m

RamirezAmayaS avatar Aug 28 '20 16:08 RamirezAmayaS

ok, unfortunately I don't have the expertise on the contribution endpoints. You can contact the team that owns them by submitting feedback in the feedback section on the REST doc site.

this link is to the docs for the extension management endpoints, but i believe the the same team owns the contribution endpoints. If i remember correctly they need to explicitly add scopes to make their endpoints available when using a PAT.

tedchamb avatar Aug 28 '20 16:08 tedchamb

@RamirezAmayaS, did you manage to solve the issue?

igor-i-plotnikov avatar Feb 04 '22 15:02 igor-i-plotnikov

@igor-i-plotnikov I did not.

RamirezAmayaS avatar Aug 23 '22 21:08 RamirezAmayaS

I had same issue with "pipelines" client. I only added "pipelines" permission into the PAT scope. but then I went from multiple scopes to least. And I endup with scopes - "pipelines", "graph" - read, "identity"-read. You may need something similar. Use same approach as me.

Peter

eissko avatar Aug 23 '23 13:08 eissko