OAuthLogin is available as a NuGet package. You can install it using the NuGet Package Console window:
PM> Install-Package OAuthLogin
第一步:在Global.asax配置微博、微信、QQ、facebook的client_id、client_secret
protected void Application_Start(object sender, EventArgs e)
{
LoginProvider.UseFaceBook("client_id", "client_secret");
LoginProvider.UseQQ("client_id", "client_secret");
LoginProvider.UseWechat("client_id", "client_secret");
LoginProvider.UseWeibo("client_id", "client_secret");
}
第二步:在项目根目录分别新建QQ.aspx、Wechat.aspx、Webo.aspx、Facebook.aspx文件
protected void Page_Load(object sender, EventArgs e)
{
var res = new QQ().Authorize();
if (res != null && res.code == 0)
{
//拿到结果数据,然后进行自定义跳转
//res.result
}
}
protected void Page_Load(object sender, EventArgs e)
{
var res = new Wechat().Authorize();
if (res != null && res.code == 0)
{
//拿到结果数据,然后进行自定义跳转
//res.result
}
}
protected void Page_Load(object sender, EventArgs e)
{
var res = new Weibo().Authorize();
if (res != null && res.code == 0)
{
//拿到结果数据,然后进行自定义跳转
//res.result
}
}
protected void Page_Load(object sender, EventArgs e)
{
var res = new Facebook().Authorize();
if (res != null&& res.code==0)
{
//拿到结果数据,然后进行自定义跳转
//res.result
}
}