GithubHelp home page GithubHelp logo

lulzzz / oauthlogin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from seven1986/oauthlogin

0.0 2.0 0.0 31 KB

第三方平台联合登陆(facebook、微信、微博、QQ、Kakao)

License: Apache License 2.0

C# 100.00%

oauthlogin's Introduction

OAuthLogin Build status NuGet Join the chat at https://gitter.im/OAuthLogin/OAuthLogin Average time to resolve an issue GitHub license

NuGet downloads (OAuthLogin) NuGet downloads (OAuthLogin.AspNetCore)
NuGet downloads OAuthLogin NuGet downloads OAuthLogin.AspNetCore

Installation

OAuthLogin is available as a NuGet package. You can install it using the NuGet Package Console window:

PM> Install-Package OAuthLogin

If you are looking for the ASP.NET Core version please head to OAuthLogin.AspNetCore project.


Usage

第一步:在Global.asax配置微博、微信、QQ、facebook、Kakao的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");

            LoginProvider.UseKakao("client_id");
        }

第二步:在项目根目录分别新建QQ.aspx、Wechat.aspx、Webo.aspx、Facebook.aspx文件

QQ.aspx
 protected void Page_Load(object sender, EventArgs e)
        {
            var res = new QQ().Authorize();

            if (res != null && res.code == 0)
            {
                //拿到结果数据,然后进行自定义跳转
                //res.result
            }
        }
Wechat.aspx
protected void Page_Load(object sender, EventArgs e)
        {
            var res = new Wechat().Authorize();

            if (res != null && res.code == 0)
            {
                //拿到结果数据,然后进行自定义跳转
                //res.result
            }
        }
Webo.aspx
protected void Page_Load(object sender, EventArgs e)
        {
            var res = new Weibo().Authorize();

            if (res != null && res.code == 0)
            {
                //拿到结果数据,然后进行自定义跳转
                //res.result
            }
        }
Facebook.aspx
protected void Page_Load(object sender, EventArgs e)
        {
            var res = new Facebook().Authorize();

            if (res != null && res.code==0)
            {
                //拿到结果数据,然后进行自定义跳转
                //res.result
            }
        }
Kakao.aspx
protected void Page_Load(object sender, EventArgs e)
        {
            var res = new Kakao().Authorize();

            if (res != null&& res.code==0)
            {
                //拿到结果数据,然后进行自定义跳转
                //res.result
            }
        }

oauthlogin's People

Contributors

seven1276 avatar seven1986 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.