protected void Page_Load(object sender, EventArgs e)
        {
            oAuth = new oAuth4Square();
            oAuth.ConsumerKey = ""; //insert your client id/key
            oAuth.ConsumerSecret = ""; //insert your client secret
            oAuth.CallBackUrl = ""; //insert your callback url
            if (Request.QueryString["code"] == null)
            {
                fsquareauthenticateurl = oAuth.oAuthRequestToken + "?" + "client_id=" + oAuth.ConsumerKey + "&response_type=code&redirect_uri=" + oAuth.CallBackUrl;
            }
            else
            {
                string retjson;
                string tokenvalue;
                FSquareToken fstoken = new FSquareToken();
                try
                {
                    retjson = oAuth.oAuthRequest(Request.QueryString["code"]);
                    fstoken = GetFSquareTokenDetails(retjson);
                    //the authenticated token we get back from foursquare
                    tokenvalue = fstoken.AccessToken;

                    //now that we have the token, lets start making requests to the API
                    string apiurl = "https://api.foursquare.com/v2/users/self";
                    retjson = oAuth.oAuthRequest(apiurl, tokenvalue);
                    jsonresponse = retjson;
                }
                catch (Exception oe)
                {
                    Response.Write("Begin -- " + oe.Message + "--" + oe.StackTrace);
                }
            }
        }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            oAuth                = new oAuth4Square();
            oAuth.ConsumerKey    = ""; //insert your client id/key
            oAuth.ConsumerSecret = ""; //insert your client secret
            oAuth.CallBackUrl    = ""; //insert your callback url
            if (Request.QueryString["code"] == null)
            {
                fsquareauthenticateurl = oAuth.oAuthRequestToken + "?" + "client_id=" + oAuth.ConsumerKey + "&response_type=code&redirect_uri=" + oAuth.CallBackUrl;
            }
            else
            {
                string       retjson;
                string       tokenvalue;
                FSquareToken fstoken = new FSquareToken();
                try
                {
                    retjson = oAuth.oAuthRequest(Request.QueryString["code"]);
                    fstoken = GetFSquareTokenDetails(retjson);
                    //the authenticated token we get back from foursquare
                    tokenvalue = fstoken.AccessToken;

                    //now that we have the token, lets start making requests to the API
                    string apiurl = "https://api.foursquare.com/v2/users/self";
                    retjson      = oAuth.oAuthRequest(apiurl, tokenvalue);
                    jsonresponse = retjson;
                }
                catch (Exception oe)
                {
                    Response.Write("Begin -- " + oe.Message + "--" + oe.StackTrace);
                }
            }
        }
Ejemplo n.º 3
0
 public FoursquareOAuth(string userToken)
 {
     oAuth = new oAuth4Square();
     oAuth.ConsumerKey = ConfigurationManager.AppSettings["FSQClientID"];
     oAuth.ConsumerSecret = ConfigurationManager.AppSettings["FSQClientSecret"];
     oAuth.CallBackUrl = ConfigurationManager.AppSettings["FSQCallback"];
     Token = userToken;
 }
Ejemplo n.º 4
0
 public FoursquareOAuth(string userToken)
 {
     oAuth                = new oAuth4Square();
     oAuth.ConsumerKey    = ConfigurationManager.AppSettings["FSQClientID"];
     oAuth.ConsumerSecret = ConfigurationManager.AppSettings["FSQClientSecret"];
     oAuth.CallBackUrl    = ConfigurationManager.AppSettings["FSQCallback"];
     Token                = userToken;
 }