Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var values = new Dictionary<string, string>
- {
- { "client_id", ClientId },
- { "scope", "openid offline_access https://graph.microsoft.com/.default" },
- { "client_secret", clientSecret },
- { "grant_type", "client_credentials" }
- };
- var content = new FormUrlEncodedContent(values);
- var response = await client.PostAsync($"https://login.microsoftonline.com/{**tenantID**}/oauth2/v2.0/token", content);
- string token = await response.Content.ReadAsStringAsync();
- JObject accessToken = JObject.Parse(token);
- string access = (string)accessToken["access_token"];
- return access;
- var url = $"https://login.microsoftonline.com/{tenantDomain}/adminconsent?"
- + $"client_id={ClientId}"
- + "&state=12345"
- + "&redirect_uri=http://localhost";
- var verifyButtonClick = function () {
- var url = $"https://login.microsoftonline.com/{tenantDomain}/adminconsent?"
- + "client_id=" + $("#clientID").val()
- + "&state=12345"
- + "&redirect_uri="+ window.location.href.split("?")[0];
- window.open(url);
- }
- HttpClient client = new HttpClient();
- client.BaseAddress = new Uri(url);
- client.DefaultRequestHeaders.Accept.Add(new
- MediaTypeWithQualityHeaderValue("application/json"));
- HttpResponseMessage response = client.GetAsync(url).Result;
Add Comment
Please, Sign In to add comment