CollectiveOAuth - C# 第三方授权框架


MIT
跨平台
C#

软件简介

![](/static/assets/osapp/images/4d8b9aee5ad2282eb9e1294150c85825.png) ![](/static/assets/osapp/images/6d8cdc95834cfc22fb40986f0ab3565d.png) ![](/static/assets/osapp/images/41582c874ad22870db379ff9d5febe96.png) ![](/static/assets/osapp/images/34d71d2b5f6c4a5ba401b490032f5671.png) ![](/static/assets/osapp/images/dd9fbb29c87c8066c33b09b244581d74.png) ![](/static/assets/osapp/images/234e513d341b3dd2094d0e074d72ce1b.png) ![](/static/assets/osapp/images/4ea9b01942c7ccd28ba16fe076baf6fa.png) ![](/static/assets/osapp/images/a853949a16cb926eb423eb031070e825.png) ![](/static/assets/osapp/images/aba94de5bf8dfddffbd619d6cdaaee31.png) ![](/static/assets/osapp/images/919d06b985c09eb32edc46c469012bb5.png) ![](/static/assets/osapp/images/7ee3a954fefbabbad9372b7b4f6244d6.png) ![](/static/assets/osapp/images/93af1a4f410e2ff0d05e78b8edf080d8.png) ![](/static/assets/osapp/images/dabe8a21b3e44f1d715f1b6a3f53df7c.png) ![](/static/assets/osapp/images/379ebf0e0315ad6fa6d07859ee1e96b2.png) ![](/static/assets/osapp/images/b340a3e638fd7c7d0072c4a85df50f35.png)


















.Net平台下 CollectiveOAuth ,它仅仅是一个 第三方授权登录工具类库
,它可以让我们脱离繁琐的第三方登录SDK,让登录变得 So easy!

特点

废话不多说,就俩字:

  1. :已集成十多家第三方平台(国内外常用的基本都已包含),仍然还在持续扩展中([开发计划(制作中)]!
  2. :API就是奔着最简单去设计的(见后面快速开始),尽量让您用起来没有障碍感!

快速开始

  • 引入依赖

  • 配置授权信息(默认配置在webconfig中, 可以改造存储数据库或者其它任意地方)

    1
    2
    3
    4
    5 value="https://yours.domain.com/oauth2/callback?authSource=WECHAT_MP" />

  • 调用api

    // 创建授权request

    1 var clientConfig = new ClientConfig();
    2 clientConfig.clientId = AppSettingUtils.GetStrValue($”CollectiveOAuth_XXXXXX_ClientId”);
    3 clientConfig.clientSecret = AppSettingUtils.GetStrValue($”CollectiveOAuth_XXXXXX_ClientSecret”);
    4 clientConfig.redirectUri = AppSettingUtils.GetStrValue($”CollectiveOAuth_XXXXXX_RedirectUri”);
    5 clientConfig.scope = AppSettingUtils.GetStrValue($”CollectiveOAuth_XXXXXX_Scope”);
    6
    7 AuthRequest authRequest = new GiteeAuthRequest(clientConfig);
    8 // 生成授权页面
    9 authRequest.authorize(“state”);
    10 // 授权登录后会返回code(auth_code(仅限支付宝))、state,可以用AuthCallback类作为回调接口的参数
    11 // 注:CollectiveOAuth默认保存state的时效为5分钟,5分钟内未使用则会自动清除过期的state
    12 authRequest.login(callback);

API列表

![](/static/assets/osapp/images/cf3c159012a238f7e1b94ed997ac0e1c.png) 平台 ![](/static/assets/osapp/images/2e5bfa97a7b93f9d9ab7aff4f8ff419e.png) API类 ![](/static/assets/osapp/images/924d157b1ef0fea257937d3cd693dcf5.png) SDK
![](/static/assets/osapp/images/4d8b9aee5ad2282eb9e1294150c85825.png) [GiteeAuthSource](https://gitee.com/rthinking/CollectiveOAuth/blob/master/Come.CollectiveOAuth/Request/AuthRequests/GiteeAuthRequest.cs) [参考文档](https://gitee.com/api/v5/oauth_doc#list_1)
![](/static/assets/osapp/images/6d8cdc95834cfc22fb40986f0ab3565d.png) [GithubAuthRequest](https://gitee.com/rthinking/CollectiveOAuth/blob/master/Come.CollectiveOAuth/Request/AuthRequests/GithubAuthRequest.cs) [参考文档](https://developer.github.com/apps/building-oauth-apps/authorizing- oauth-apps/)
![](/static/assets/osapp/images/41582c874ad22870db379ff9d5febe96.png) [WeiboAuthRequest](https://gitee.com/rthinking/CollectiveOAuth/blob/master/Come.CollectiveOAuth/Request/AuthRequests/WeiboAuthRequest.cs) [参考文档](https://open.weibo.com/wiki/%E6%8E%88%E6%9D%83%E6%9C%BA%E5%88%B6%E8%AF%B4%E6%98%8E)
![](/static/assets/osapp/images/34d71d2b5f6c4a5ba401b490032f5671.png) [DingTalkScanAuthRequest](https://gitee.com/rthinking/CollectiveOAuth/blob/master/Come.CollectiveOAuth/Request/AuthRequests/DingTalkScanAuthRequest.cs) [参考文档](https://open-doc.dingtalk.com/microapp/serverapi2/kymkv6)
![](/static/assets/osapp/images/dd9fbb29c87c8066c33b09b244581d74.png) [BaiduAuthRequest](https://gitee.com/rthinking/CollectiveOAuth/blob/master/Come.CollectiveOAuth/Request/AuthRequests/BaiduAuthRequest.cs) [参考文档](http://developer.baidu.com/wiki/index.php?title=docs/oauth)
![](/static/assets/osapp/images/234e513d341b3dd2094d0e074d72ce1b.png) [CodingAuthRequest](https://gitee.com/rthinking/CollectiveOAuth/blob/master/Come.CollectiveOAuth/Request/AuthRequests/CodingAuthRequest.cs) [参考文档](https://open.coding.net/references/oauth/)
![](/static/assets/osapp/images/a853949a16cb926eb423eb031070e825.png) [OschinaAuthRequest](https://gitee.com/rthinking/CollectiveOAuth/blob/master/Come.CollectiveOAuth/Request/AuthRequests/OschinaAuthRequest.cs) [参考文档](https://www.oschina.net/openapi/docs/oauth2_authorize)
![](/static/assets/osapp/images/aba94de5bf8dfddffbd619d6cdaaee31.png) [AlipayMPAuthRequest](https://gitee.com/rthinking/CollectiveOAuth/blob/master/Come.CollectiveOAuth/Request/AuthRequests/AlipayMpAuthRequest.cs) [参考文档](https://alipay.open.taobao.com/docs/doc.htm?spm=a219a.7629140.0.0.336d4b70GUKXOl&treeId=193&articleId=105809&docType=1)
![](/static/assets/osapp/images/919d06b985c09eb32edc46c469012bb5.png) [QQAuthRequest](https://gitee.com/rthinking/CollectiveOAuth/blob/master/Come.CollectiveOAuth/Request/AuthRequests/QQAuthRequest.cs) [参考文档](https://wiki.connect.qq.com/%E4%BD%BF%E7%94%A8authorization_code%E8%8E%B7%E5%8F%96access_token)
![](/static/assets/osapp/images/7ee3a954fefbabbad9372b7b4f6244d6.png) [WeChatOpenAuthRequest](https://gitee.com/rthinking/CollectiveOAuth/blob/master/Come.CollectiveOAuth/Request/AuthRequests/WeChatOpenAuthRequest.cs) [参考文档](https://open.weixin.qq.com/cgi- bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=open1419316505&token=&lang=zh_CN)
![](/static/assets/osapp/images/7ee3a954fefbabbad9372b7b4f6244d6.png) [WeChatMPAuthRequest](https://gitee.com/rthinking/CollectiveOAuth/blob/master/Come.CollectiveOAuth/Request/AuthRequests/WeChatMpAuthRequest.cs) [参考文档](https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/Wechat_webpage_authorization.html)
![](/static/assets/osapp/images/7ee3a954fefbabbad9372b7b4f6244d6.png) [WeChatEnterpriseAuthRequest](https://gitee.com/rthinking/CollectiveOAuth/blob/master/Come.CollectiveOAuth/Request/AuthRequests/WeChatEnterpriseAuthRequest.cs) [参考文档](https://open.work.weixin.qq.com/api/doc#90000/90135/90664)
![](/static/assets/osapp/images/7ee3a954fefbabbad9372b7b4f6244d6.png) [WeChatEnterpriseScanAuthRequest](https://gitee.com/rthinking/CollectiveOAuth/blob/master/Come.CollectiveOAuth/Request/AuthRequests/WeChatEnterpriseScanAuthRequest.cs) [参考文档](https://open.work.weixin.qq.com/api/doc#90000/90135/90664)
![](/static/assets/osapp/images/93af1a4f410e2ff0d05e78b8edf080d8.png) [TaobaoAuthRequest] [参考文档](https://open.taobao.com/doc.htm?spm=a219a.7386797.0.0.4e00669acnkQy6&source=search&docId=105590&docType=1)
![](/static/assets/osapp/images/dabe8a21b3e44f1d715f1b6a3f53df7c.png) [GoogleAuthRequest](https://gitee.com/rthinking/CollectiveOAuth/blob/master/Come.CollectiveOAuth/Request/AuthRequests/GoogleAuthRequest.cs) [参考文档](https://developers.google.com/identity/protocols/OpenIDConnect)
![](/static/assets/osapp/images/379ebf0e0315ad6fa6d07859ee1e96b2.png) [FacebookAuthRequest](https://gitee.com/rthinking/CollectiveOAuth/blob/master/Come.CollectiveOAuth/Request/AuthRequests/FackbookAuthRequest.cs) [参考文档](https://developers.facebook.com/docs/facebook-login/manually-build-a- login-flow)
![](/static/assets/osapp/images/b340a3e638fd7c7d0072c4a85df50f35.png) [DouYinAuthRequest](https://gitee.com/rthinking/CollectiveOAuth/blob/master/Come.CollectiveOAuth/Request/AuthRequests/DouYinAuthRequest.cs) [参考文档](https://www.douyin.com/platform/doc/m-2-1-1)
![](/static/assets/osapp/images/c088fddcc52293373274bfc2b733a059.png) [LinkedInAuthRequest](https://gitee.com/rthinking/CollectiveOAuth/blob/master/Come.CollectiveOAuth/Request/AuthRequests/LinkedinAuthRequest.cs) [参考文档](https://docs.microsoft.com/zh- cn/linkedin/shared/authentication/authorization-code- flow?context=linkedin/context)
![](/static/assets/osapp/images/534b146890e41c203833d638bf2d3181.png) [MicrosoftAuthRequest](https://gitee.com/rthinking/CollectiveOAuth/blob/master/Come.CollectiveOAuth/Request/AuthRequests/MicrosoftAuthRequest.cs) [参考文档](https://docs.microsoft.com/zh-cn/graph/auth/)
![](/static/assets/osapp/images/df81322678fe305c2f97966ccd3c3b50.png) [XiaoMiAuthRequest](https://gitee.com/rthinking/CollectiveOAuth/blob/master/Come.CollectiveOAuth/Request/AuthRequests/XiaoMiAuthRequest.cs) [参考文档](https://dev.mi.com/console/doc/detail?pId=711)
![](/static/assets/osapp/images/73b1b9efe8b39e2a39f063d44d03a878.png) [ToutiaoAuthRequest](https://gitee.com/rthinking/CollectiveOAuth/blob/master/Come.CollectiveOAuth/Request/AuthRequests/ToutiaoAuthRequest.cs) [参考文档](https://open.mp.toutiao.com/#/resource?_k=y7mfgk)
![](/static/assets/osapp/images/b92a027778843e2a0d99cdca8cd88405.png) [TeambitionAuthRequest](https://gitee.com/rthinking/CollectiveOAuth/blob/master/Come.CollectiveOAuth/Request/AuthRequests/TeambitionAuthRequest.cs) [参考文档](https://docs.teambition.com/)
![](/static/assets/osapp/images/02c39bd423e53a96030d8fb06a8b3f67.png) [RenrenAuthRequest](https://gitee.com/rthinking/CollectiveOAuth/blob/master/Come.CollectiveOAuth/Request/AuthRequests/RenrenAuthRequest.cs) [参考文档](http://open.renren.com/wiki/OAuth2.0)
![](/static/assets/osapp/images/d0a182bffd22a74c15ed3e112d3ed8fc.png) [PinterestAuthRequest](https://gitee.com/rthinking/CollectiveOAuth/blob/master/Come.CollectiveOAuth/Request/AuthRequests/PinterestAuthRequest.cs) [参考文档](https://developers.pinterest.com/docs/api/overview/?)
![](/static/assets/osapp/images/4fa9be73d5b8a9263ed33e661f458aa4.png) [StackOverflowAuthRequest](https://gitee.com/rthinking/CollectiveOAuth/blob/master/Come.CollectiveOAuth/Request/AuthRequests/StackOverflowAuthRequest.cs) [参考文档](https://api.stackexchange.com/docs/authentication)
![](/static/assets/osapp/images/cebedc0301b40b4bc501ed397c8be69e.png) [HuaweiAuthRequest](https://gitee.com/rthinking/CollectiveOAuth/blob/master/Come.CollectiveOAuth/Request/AuthRequests/HuaweiAuthRequest.cs) [参考文档](https://developer.huawei.com/consumer/cn/devservice/doc/30101)
![](/static/assets/osapp/images/8a35d60e3c131de38c76c5b31a33c639.png) [KujialeAuthRequest](https://gitee.com/rthinking/CollectiveOAuth/blob/master/Come.CollectiveOAuth/Request/AuthRequests/KujialeAuthRequest.cs) [参考文档](https://open.kujiale.com/open/apps/2/docs?doc_id=95)
![](/static/assets/osapp/images/630a9747edb0a73ac16e9b1b9b51de6f.png) [GitlabAuthRequest](https://gitee.com/rthinking/CollectiveOAuth/blob/master/Come.CollectiveOAuth/Request/AuthRequests/GitlabAuthRequest.cs) [参考文档](https://docs.gitlab.com/ee/api/oauth2.html)
![](/static/assets/osapp/images/b9d611834f89e04ec6117d95c6162bc2.png) [MeituanAuthRequest](https://gitee.com/rthinking/CollectiveOAuth/blob/master/Come.CollectiveOAuth/Request/AuthRequests/MeituanAuthRequest.cs) [参考文档](http://open.waimai.meituan.com/openapi_docs/oauth/)
![](/static/assets/osapp/images/3befff4fc067f4a2323831d9346b3ab4.png) [ElemeAuthRequest](https://gitee.com/rthinking/CollectiveOAuth/blob/master/Come.CollectiveOAuth/Request/AuthRequests/ElemeAuthRequest.cs) [参考文档](https://open.shop.ele.me/openapi/documents/khd001)
![](/static/assets/osapp/images/04ec2d7b85597619872a3ff0f9d77ede.png) [TwitterAuthRequest] [参考文档](https://developer.twitter.com/en/docs/twitter-for-websites/log-in-with- twitter/guides/implementing-sign-in-with-twitter)

_请知悉:经咨询CSDN官方客服得知,CSDN的授权开放平台已经下线。如果以前申请过的应用,可以继续使用,但是不再支持申请新的应用。