JumboTCMS_src/JumboTCMS.OAuth2/OAuths/SinaOAuth.cs
(开头部分) 3KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.Text;
namespace JumboTCMS.OAuth2
{
public class SinaOAuth : OAuth2Base
{
internal override OAuthServer server
{
get
{
return OAuthServer.Sina;
}
}
internal override string OAuthUrl
{
get
{
return "https://api.weibo.com/oauth2/authorize?response_type=code&client_id={0}&redirect_uri={1}&state={2}";
}
}
internal override string TokenUrl
{
get
{
return "https://api.weibo.com/oauth2/access_token";
}
}
internal string UserInfoUrl = "https://api.weibo.com/2/users/show.json?access_token={0}&uid={1}";
public override string GetAuthorizeURL()
{
return string.Format(OAuthUrl, AppKey, System.Web.HttpUtility.UrlEncode(CallbackUrl), "Sina");
}
public override bool Authorize()
{
if (!string.IsNullOrEmpty(code))
{
string result = GetToken("POST", "Sina");//一次性返回数据。
//分解result;
if (!string.IsNullOrEmpty(result))
{
try
{
Dictionary<string, string> items = CYQ.Data.Tool.JsonHelper.Split(result);
if (items != null && items.Count > 0)
{
foreach (KeyValuePair<string, string> item in items)
{
switch (item.Key)
{
case "access_token":
token = item.Value;
break;
case "expires_in":
double d = 0;
if (double.TryParse(item.Value, out d) && d > 0)
{
expiresTime = DateTime.Now.AddSeconds(d);
}
后面还有 33 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。