はい。 リソースオーナーパスワード資格情報フローのHTTPリクエストを直接使用してトークンを取得することは可能です。
Fiddlerを使用して、要求された詳細パラメータを表示する要求をキャプチャできます。
string resrouce = "https://graph.windows.net";
string clientId = "";
string userName = "";
string password = "";
HttpClient client = new HttpClient();
string body = String.Format("resource={0}&client_id={1}&grant_type=password&username={2}&password={3}", Uri.EscapeDataString(resrouce), clientId, Uri.EscapeDataString(userName), Uri.EscapeDataString(password));
StringContent sc = new StringContent(body,Encoding.UTF8, "application/x-www-form-urlencoded");
var resoult= client.PostAsync("https://login.microsoftonline.com/xxxx.onmicrosoft.com/oauth2/token", sc).Result.Content.ReadAsStringAsync().Result;
そして、あなたはウェブアプリで作業している場合、我々は体内でclient_secret
パラメータを追加する必要があります。そして、ここでのサンプルコードは、ネイティブ・クライアント・アプリケーションのためのアクセストークンを取得するには、このフローを使用することです。
このようなもの:http://stackoverflow.com/a/41159005/1658906? – juunas