0

From the documentation here https://learn.microsoft.com/en-us/azure/devops/integrate/get-started/authentication/oauth?view=azure-devops , it seems it is possible for an application to use OAuth2 Authorization Code Flow to get an access token. However, if i try to get the access token using client credentials flow I get invalid_resource error. It seems the token endpoint support the client credential flow, but I cant get it working.

POST https://app.vssps.visualstudio.com/oauth2/token
Content-Type application/x-www-form-urlencoded

grant_type=client_credentials&redirect_uri=$url&client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer&client_assertion=$assertion&client_id=$clientid&client_secret=$secret&scope=vso.code

what could be the correct resource value?

SureshAtt
  • 1,891
  • 2
  • 17
  • 22

1 Answers1

0

Donot know if below microsoft document is what you are looking for, it describes how to use client credential flow. Hope it helps!

https://learn.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-client-creds-grant-flow

Levi Lu-MSFT
  • 27,483
  • 2
  • 31
  • 43
  • Hi @Levi, thanks for the reply. Actually the documentation has described the OAuth2 authorization code grant flow. What I want to know if the OAuth2 client credential flow can be used. I could get the authorization code flow working without a problem. – SureshAtt Nov 22 '19 at 10:20
  • Hi @ SureshAtt Did you get a chance to check out above link? Please let me know how did it go? – Levi Lu-MSFT Nov 27 '19 at 12:41
  • 1
    This approach didn't work. Because above link is for azure ad while I need to get token from here https://app.vssps.visualstudio.com/oauth2/token which is not azure ad. – SureshAtt Nov 27 '19 at 14:29
  • @Levi - did you end up getting this working. It looks like I have been down the same confusing path as you and I can get any decent consistent information. Here is my question: https://stackoverflow.com/questions/60875738/client-credentials-flow-for-azure-devops – RuSs Mar 26 '20 at 20:58