Ejemplo n.º 1
0
        public static FacebookCookie Parse(string value, string appSecret)
        {
            var args = GetArguments(value);
            if (!FacebookCookie.Validate(args, appSecret))
            {
                throw new Exception("Invalid cookie.");
            }

            var cookie = new FacebookCookie();

            DateTime expires;
            DateTime.TryParse(args["expires"], out expires);
            cookie.ExpiresOn = expires;

            long userId;
            long.TryParse(args["uid"], out userId);
            cookie.UserId = userId;

            cookie.Secret = args["secret"];
            cookie.SessionKey = args["session_key"];
            cookie.Signature = args["sig"];
            cookie.AccessToken = args["access_token"];

            return cookie;
        }
Ejemplo n.º 2
0
 private bool IsConnected()
 {
     if (cookie == null)
     {
         cookie = FacebookCookie.GetCookie(appId, appSecret);
     }
     /*logger.Info("_________________________________________");
     logger.Info("cookie = " + cookie + " UserId = " + cookie.UserId + " sessionkey = " + cookie.SessionKey);*/
     return
         cookie != null &&
         cookie.UserId != 0 &&
         !string.IsNullOrEmpty(cookie.SessionKey);
 }