Created
March 13, 2023 21:30
-
-
Save xximjasonxx/b5fcb4d6f8c8f9709389234fbb8a386c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// See https://aka.ms/new-console-template for more information | |
using Microsoft.Identity.Client; | |
var app = ConfidentialClientApplicationBuilder | |
.Create("a43255e1-24df-4b22-94e9-4e583e6301c3") | |
.WithClientSecret("RKP8Q~LKTGJKwzsItxnpIfIVG2XMAyPG1IhvIcpk") | |
.WithAuthority(new Uri("https://login.microsoftonline.com/81699cc3-1e16-40c8-afb9-5b4e2aac2dca")) | |
.Build(); | |
var token = await app.AcquireTokenForClient(new[] | |
{ | |
//"api://428397d6-f39f-414e-ae5b-6b352e086aba/.default" | |
//"https://graph.microsoft.com/.default" | |
//"api://7589631c-d6ec-4674-889d-3ac60d7592ab/.default" | |
//"api://backend-application2/.default" | |
"api://8c09a569-597a-49c4-beb7-54077f767b43/.default" | |
}).ExecuteAsync(); | |
Console.WriteLine(token.AccessToken); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment