public void Run()
        {
            var oauth = new OauthConfiguration
            {
                Authority   = "https://login.microsoftonline.com",
                Tenant      = "common",
                ClientId    = "f6eddbd9-e3bb-4610-9ebb-0fc31291ab1e",
                RedirectURI = "urn:ietf:wg:oauth:2.0:oob"
            };

            var helper = new OauthWebAuthHelper(oauth, OauthWebAuthHelper.Version.V2);

            var token = helper.AcquireTokenWithScope("Files.Read");
        }
Beispiel #2
0
        public void Go(OauthConfiguration oauth)
        {
            var auth = new OauthWebAuthHelper(oauth);

            var tokenResponse = auth.AcquireTokenWithResource(resource: "https://outlook.office.com");

            Console.WriteLine("access token:");

            Console.WriteLine(tokenResponse);

            var accessToken = tokenResponse.GetValue("access_token").Value <string>();

            var validator = new JsonWebTokenValidator();

            var jwt = validator.Validate(accessToken);

            Console.WriteLine(JsonConvert.SerializeObject(jwt.Payload, Formatting.Indented));

            Console.ReadLine();
        }