Exemple #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>"));
        }
Exemple #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));
        }
Exemple #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));
        }
Exemple #4
0
        public ActionResult SendAuth(string scope, string redirect)
        {
            var x = GoogleScopeRequest.GetRequestCodeUrl(scope, redirect);

            return(Redirect(x));
        }