Esempio n. 1
0
        private FSquareToken GetFSquareTokenDetails(string json)
        {
            DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(FSquareToken));

            using (MemoryStream stream = new MemoryStream(Encoding.Unicode.GetBytes(json)))
            {
                FSquareToken list = (FSquareToken)serializer.ReadObject(stream);
                return(list);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Authenticates user using code from Foursquare response
        /// </summary>
        /// <param name="code">Response code</param>
        /// <returns></returns>
        public bool makeAuthentication(string code)
        {
            string       retjson;
            FSquareToken fstoken = new FSquareToken();

            try
            {
                retjson = oAuth.oAuthRequest(code);
                fstoken = GetFSquareTokenDetails(retjson);
                //the authenticated token we get back from foursquare
                token       = fstoken.AccessToken;
                oAuth.Token = token;
            }
            catch (Exception oe)
            {
                return(false);
            }
            return(true);
        }
Esempio n. 3
0
 /// <summary>
 /// Authenticates user using code from Foursquare response
 /// </summary>
 /// <param name="code">Response code</param>
 /// <returns></returns>
 public bool makeAuthentication(string code)
 {
     string retjson;
     FSquareToken fstoken = new FSquareToken();
     try
     {
         retjson = oAuth.oAuthRequest(code);
         fstoken = GetFSquareTokenDetails(retjson);
         //the authenticated token we get back from foursquare
         token = fstoken.AccessToken;
         oAuth.Token = token;
     }
     catch (Exception oe)
     {
         return false;
     }
     return true;
 }