CollectiveOAuthCore 1.1.0
dotnet add package CollectiveOAuthCore --version 1.1.0
NuGet\Install-Package CollectiveOAuthCore -Version 1.1.0
<PackageReference Include="CollectiveOAuthCore" Version="1.1.0" />
<PackageVersion Include="CollectiveOAuthCore" Version="1.1.0" />
<PackageReference Include="CollectiveOAuthCore" />
paket add CollectiveOAuthCore --version 1.1.0
#r "nuget: CollectiveOAuthCore, 1.1.0"
#:package CollectiveOAuthCore@1.1.0
#addin nuget:?package=CollectiveOAuthCore&version=1.1.0
#tool nuget:?package=CollectiveOAuthCore&version=1.1.0
CollectiveOAuthCore
CollectiveOAuthCore is a third-party login (OAuth2 / OIDC) integration library for ASP.NET Core.
It wraps the authorization flows of 30+ domestic and international platforms behind a unified
AuthRequest API, so you can add social login to your app with just a few lines of code.
.NET 平台下的第三方授权登录工具类库,封装主流平台 OAuth2 / OIDC 流程,统一返回
AuthUser,让第三方登录接入 So easy!
Features
- Wide coverage – 30+ platforms (GitHub, Google, Microsoft, LinkedIn, Facebook, Weibo, QQ, WeChat Open/MP/Enterprise, Alipay, Gitee, GitLab, Baidu, XiaoMi, Huawei, Douyin, Meituan, Eleme …).
- Simple API – one
authorize(state)+login(callback)flow for every platform. - Unified model –
AuthUserwithuuid / nickname / avatar / email / token / source. - State anti-replay – built-in
IAuthStateCache, customizable (e.g. Redis for multi-instance). - Async & DI friendly –
loginAsync/refreshAsync/revokeAsync, injectableHttpClient. - Multi-target –
net8.0,net9.0,net10.0.
Installation
dotnet add package CollectiveOAuthCore
Quick Start
1. Configure a client
using Come.CollectiveOAuth.Config;
var config = new ClientConfig
{
clientId = "your-client-id",
clientSecret = "your-client-secret",
redirectUri = "https://your-domain.com/callback/github",
scope = "user:email"
};
2. Redirect to the authorization page
using Come.CollectiveOAuth.Request;
using Come.CollectiveOAuth.Utils;
var request = new GithubAuthRequest(config);
string state = AuthStateUtils.createState();
return Redirect(request.authorize(state));
3. Handle the callback
public IActionResult Callback(AuthCallback callback)
{
var request = new GithubAuthRequest(config); // same cache instance as step 2
AuthResponse response = request.login(callback);
if (response.ok()) // code == 2000 means success
{
AuthUser user = (AuthUser)response.data;
// user.uuid / user.nickname / user.avatar / user.email / user.token
}
return View();
}
Note:
authorizeandloginmust share the sameIAuthStateCacheinstance; otherwise state validation fails on callback. The defaultDefaultAuthStateCacheuses in-processIMemoryCache(fine for single-instance). For multi-instance deployments, inject a shared cache (Redis, etc.) implementingIAuthStateCache.
Supported Platforms
| authSource | Platform | Notes |
|---|---|---|
GITHUB |
GitHub | default scope user:email |
GOOGLE |
OIDC | |
MICROSOFT |
Microsoft | needs offline_access for refresh token |
LINKEDIN |
OpenID Connect (openid profile email) |
|
FACEBOOK |
sensitive fields need App Review | |
WEIBO |
微博 | — |
QQ |
unionId available with extra permission |
|
WECHAT_OPEN / WECHAT_MP / WECHAT_ENTERPRISE / WECHAT_ENTERPRISE_SCAN |
Open / MP / Enterprise | |
ALIPAY_MP |
Alipay | requires alipayPublicKey |
GITEE / OSCHINA / CODING / GITLAB |
Code hosting | — |
BAIDU / XIAOMI / HUAWEI / KUJIALE |
Domestic vendors | — |
DOUYIN / TOUTIAO |
ByteDance | — |
MEITUAN / ELEME |
Meituan / Eleme | — |
STACK_OVERFLOW / PINTEREST / RENREN / TEAMBITION |
Others | — |
Namespaces
using Come.CollectiveOAuth.Config;
using Come.CollectiveOAuth.Models;
using Come.CollectiveOAuth.Request;
using Come.CollectiveOAuth.Utils;
using Come.CollectiveOAuth.Cache;
More
- Full docs (中文): see
使用文档.md/使用文档.en.mdshipped with the source. - Sample:
Come.AspNetCore.Samplefor a complete ASP.NET Core demo. - Source: https://gitee.com/izory/CollectiveOAuth
License
MIT — see LICENSE.
Inspired by the JustAuth project.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Newtonsoft.Json (>= 13.0.3)
-
net8.0
- Newtonsoft.Json (>= 13.0.3)
-
net9.0
- Newtonsoft.Json (>= 13.0.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.1.0 | 43 | 9/30/2026 |
| 1.0.1 | 284 | 1/5/2025 |
| 1.0.1-alpha | 204 | 1/4/2025 |
| 1.0.0 | 226 | 5/29/2024 |
| 1.0.0-alpha | 175 | 5/29/2024 |