I have successfully authenticated with Azure AD and received an access token. And I have given Azure AD App API permissions to Access Azure DevOps
I am using RestSharp Http Client do authenticate
var client = new RestClient("https://login.microsoftonline.com/{tenant}/oauth2/token");
var request = new RestRequest("", Method.POST);
request.AddParameter("grant_type", "client_credentials");
request.AddParameter("client_id", "00000f-0000-00-00-000000");
request.AddParameter("client_secret", "][M.&*******?*_5z)y${*[)");
request.AddParameter("resourse", "https://tenant.onmicrosoft.com/4815c06b-7e28-4f88-9dc8-8fe3354d5909");
IRestResponse response = client.Execute(request);
var content = response.Content; // raw con
I am happy up to this point. What I can't figure out is how to use the access token to access Azure DevOps What I have tried thus far
var client = new RestClient("https://app.vssps.visualstudio.com/oauth2/token");
var request = new RestRequest("", Method.POST);
request.AddParameter("client_id", "My APP code here";
request.AddParameter("client_secret", "My ap secret here");
request.AddParameter("client_assertion_type", "urn:ietf:params:oauth:client-assertion-type:jwt-bearer");
request.AddParameter("client_assertion", "access token here");
request.AddParameter("grant_type", "authorization_code");
The error I am receiving is "{\"Error\":\"unsupported_grant_type\",\"ErrorDescription\":\"grant_type must be the ietf jwt-bearer type or refresh_token\"}"
What am I missing?