CSP_Graph.Services.GraphService.AcquireTokenForApplicationAsync C# (CSharp) Method

AcquireTokenForApplicationAsync() public method

public AcquireTokenForApplicationAsync ( ) : Task
return Task
        public Task<Token> AcquireTokenForApplicationAsync()
        {
            string uri = string.Format("{0}/{1}/oauth2/token", authUrl, tenant_name);
            string contentType = "application/x-www-form-urlencoded";
            string content = string.Format("grant_type=client_credentials&client_id={0}&client_secret={1}&resource={2}", app_id, HttpUtility.UrlEncode(app_key), HttpUtility.UrlEncode(graphApiUrl));

            APIService service = new APIService(uri, contentType);

            return service.SendAsync<Token>(content);
        }