I'm trying to implement the OAuth 2.0 authentication (Bearer JWT token) from an Electron application in order to access Azure DevOps APIs (repos, work items, test plans).
The Azure DevOps organization is AAD-backed so I'm trying to access the Azure DevOps API using the access token given by Azure AD /token endpoint.
I'm using the Authorization code flow with PKCE to obtain the token.
However, when accessing the Azure DevOps API, I'm constantly seeing error messages regarding the wrong scope.
The scope is invalid
With curl calls, I see the following:
<html><head><title>Object moved</title></head><body>
<h2>Object moved to <a href="https://spsprodcus2.vssps.visualstudio.com/_signin?realm=dev.azure.com&reply_to=https%3A%2F%2Fdev.azure.com%2FXXXXXXX%2FXXXXX%2F_apis%2Fwit%2Fworkitems%3Fids%3D11016%252C54321%26api-version%3D6.0&redirect=1&hid=1b2cef85-XXXX-XXXX-XXXX-8b6420bc5933&context=eyJodCI6XXXXXXXXXXXXLCJjcyI6IiJ90#ctx=eyJTaWduSW5XXXXXXW5lLmNvbSJdfQ2">here</a>.</h2>
</body></html>
Of course, my AAD-registered application has Azure DevOps API permissions added:
I have tried another option - obtaining the token from Azure DevOps-backed app registration created here: https://aex.dev.azure.com/app/register but then the following error is shown:
The corresponding application isn't registered within the Azure AD tenant.
Nevertheless, I see that applications registered with the Azure DevOps portal aren't shown in the Azure AD applications list.
Thus I start thinking that either the Authorization code flow with PKCE for Azure DevOps should be different (in terms of API calls) or there's something wrong with the Azure AD application (e.g. scopes or API permissions).



](https://mapledrawhubb.com/i.sstatic.net/j6wf2.png)
