Пример #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (Request["code"] != null)
         {//登录成功后server返回的code
             var oauth = new SDK.OAuth(app_key, app_secret);
             var token = oauth.GetAccessToken(Request["code"], Request.Url.ToString());
             Session["token"] = token;
             Response.Redirect("~/");
         }
         if (Session["token"] != null)
         {
             Literal1.Text = ((SDK.AccessToken)Session["token"]).Token;
         }
     }
 }
Пример #2
0
 private void button1_Click(object sender, EventArgs e)
 {
     var oauth = new SDK.OAuth(app_key, app_secret);
     textBox3.Text = oauth.GetAccessToken2(textBox1.Text, textBox2.Text).Token;
 }
Пример #3
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     var oauth = new SDK.OAuth(app_key, app_secret);
     Response.Redirect(oauth.GetAuthorizeUrl(Request.Url.ToString()));
 }