Hishop.WeiBo.Api/OpenAuthenticationClientBase.cs
(开头部分) 8KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
namespace Hishop.WeiBo.Api
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
public abstract class OpenAuthenticationClientBase
{
protected HttpClient http;
protected bool isAccessTokenSet;
public OpenAuthenticationClientBase(string clientId, string clientSecret, string callbackUrl, string accessToken = null)
{
this.ClientId = clientId;
this.ClientSecret = clientSecret;
this.CallbackUrl = callbackUrl;
this.AccessToken = accessToken;
HttpClientHandler handler = new HttpClientHandler
{
CookieContainer = new CookieContainer(),
UseCookies = true
};
HttpClient client = new HttpClient(handler)
{
BaseAddress = new Uri(this.BaseApiUrl)
};
this.http = client;
if (!string.IsNullOrEmpty(accessToken))
{
this.isAccessTokenSet = true;
}
}
public abstract void GetAccessTokenByCode(string code);
public abstract string GetAuthorizationUrl();
private string GetNonceString(int length = 8)
{
StringBuilder builder = new StringBuilder();
Random random = new Random();
for (int i = 0; i < length; i++)
{
builder.Append((char)random.Next(0x61, 0x7b));
}
return builder.ToString();
}
public HttpResponseMessage HttpGet(string api, Dictionary<string, object> parameters = null)
{
return this.HttpGetAsync(api, parameters).Result;
}
public HttpResponseMessage HttpGet(string api, object parameters)
后面还有 146 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。
