示例#1
0
        public static void GetTokenAndCall()
        {
            var token = GoogleServiceAccount.GetAccessTokenFromJSONKey(
                "Keys/C-SharpCorner-0338f58d564f.json",
                "https://www.googleapis.com/auth/userinfo.profile");

            WriteLine(new HttpClient().GetStringAsync($"https://www.googleapis.com/plus/v1/people/110259743757395873050?access_token={token}").Result);
        }
        public static void GetTokenAndCall()
        {
            var token = GoogleServiceAccount.GetAccessTokenFromP12Key(
                "Keys/C-SharpCorner-e0883ada1a3f.p12",
                "*****@*****.**",
                "notasecret",
                "https://www.googleapis.com/auth/userinfo.profile"
                );

            WriteLine(new HttpClient().GetStringAsync($"https://www.googleapis.com/plus/v1/people/110259743757395873050?access_token={token}").Result);
        }