示例#1
0
        public ActionResult Scopes(string code)
        {
            var jsonToken = GoogleScopeRequest.GetToken(code, Constants.ScopesRedirect);
            var tokenInfo = JsonConvert.DeserializeObject <TokenResponse>(jsonToken);

            return(Content($"<html>Your token is {tokenInfo.Access_Token} :)</html>"));
        }
示例#2
0
        public ActionResult YoutubeSubs(string code)
        {
            var jsonToken        = GoogleScopeRequest.GetToken(code, Constants.YoutubeRedirect);
            var tokenInfo        = JsonConvert.DeserializeObject <TokenResponse>(jsonToken);
            var yt               = new YoutubeRO(tokenInfo.Access_Token);
            var subs             = yt.GetSubscriptions();
            var subsDeserialized = JsonConvert.DeserializeObject <SubsResponse>(subs);

            return(View(subsDeserialized));
        }
示例#3
0
        public ActionResult Gmail(string code)
        {
            var jsonToken            = GoogleScopeRequest.GetToken(code, Constants.GmailRedirect);
            var tokenInfo            = JsonConvert.DeserializeObject <TokenResponse>(jsonToken);
            var gmail                = new GmailRO(tokenInfo.Access_Token);
            var messageInfo          = gmail.GetMessages();
            var messagedDeserialized = JsonConvert.DeserializeObject <GmailMessagesResponse>(messageInfo);

            return(View(messagedDeserialized));
        }