Azure DEVOPS make pull request using on-behalf-of flow

351 Views Asked by At

I am trying to figure out what is needed so that my application is able to make a pull request on behalf of my user.

I have an app registration, for this app registration I am requesting the following API permission:

https://app.vssps.visualstudio.com/user_impersonation

Once the user accesses my REST API with a proper bearer token, I need to obtain the on-behalf token so that I may contact the Azure Devops APIs.

Question is what scopes do I need to request for the on-behalf-of token so that I may create pull requests as my authenticated user?

The git repo to which I'm trying to create the pull request is hosted on o365exchange.visualstudio.com.

1

There are 1 best solutions below

2
Antonia Wu-MSFT On

to create pull request on Azure DevOps Serivces side, you could call the rest api: POST https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repositoryId}/pullrequests?api-version=6.0

You could find the needed scope under the doc:

enter image description here

You could find the corresponding scope details in the doc: enter image description here

When you register your app, you could choose it here:

enter image description here

I hope this could do some help. Thanks.