{"id":24973048,"url":"https://github.com/myvas/aspnetcore.authentication.weixinopen","last_synced_at":"2025-04-09T17:26:26.543Z","repository":{"id":34362684,"uuid":"177926181","full_name":"myvas/AspNetCore.Authentication.WeixinOpen","owner":"myvas","description":"An ASP.NET Core authentication middleware: WeixinOpen for https://open.weixin.qq.com (微信开放平台/微信扫码登录)","archived":false,"fork":false,"pushed_at":"2025-03-28T06:50:29.000Z","size":2739,"stargazers_count":26,"open_issues_count":2,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-02T16:06:57.815Z","etag":null,"topics":["aspnetcore","authentication","authentication-middleware","myvas","netcoreapp30","netstandard20","nuget","oauth2","weixinopen"],"latest_commit_sha":null,"homepage":"http://demo.auth.myvas.com","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/myvas.png","metadata":{"files":{"readme":"README.md","changelog":"Changelog.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-03-27T05:46:03.000Z","updated_at":"2025-03-28T06:40:56.000Z","dependencies_parsed_at":"2025-01-31T07:28:19.476Z","dependency_job_id":"d4598a00-aada-4881-9760-426819cdc45c","html_url":"https://github.com/myvas/AspNetCore.Authentication.WeixinOpen","commit_stats":null,"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/myvas%2FAspNetCore.Authentication.WeixinOpen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/myvas%2FAspNetCore.Authentication.WeixinOpen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/myvas%2FAspNetCore.Authentication.WeixinOpen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/myvas%2FAspNetCore.Authentication.WeixinOpen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/myvas","download_url":"https://codeload.github.com/myvas/AspNetCore.Authentication.WeixinOpen/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248076249,"owners_count":21043735,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aspnetcore","authentication","authentication-middleware","myvas","netcoreapp30","netstandard20","nuget","oauth2","weixinopen"],"created_at":"2025-02-03T18:26:16.698Z","updated_at":"2025-04-09T17:26:26.520Z","avatar_url":"https://github.com/myvas.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Myvas.AspNetCore.Authentication Family \r\n\r\n* QQConnect (QQ互联平台/QQ身份登陆): [Here](https://github.com/myvas/AspNetCore.Authentication.QQConnect)\r\n\r\n[![GitHub (Pre-)Release Date](https://img.shields.io/github/release-date-pre/myvas/AspNetCore.Authentication.QQConnect?label=github)](https://github.com/myvas/AspNetCore.Authentication.QQConnect)\r\n[![test](https://github.com/myvas/AspNetCore.Authentication.QQConnect/actions/workflows/test.yml/badge.svg)](https://github.com/myvas/AspNetCore.Authentication.QQConnect/actions/workflows/test.yml)\r\n[![deploy](https://github.com/myvas/AspNetCore.Authentication.QQConnect/actions/workflows/publish.yml/badge.svg)](https://github.com/myvas/AspNetCore.Authentication.QQConnect/actions/workflows/publish.yml)\r\n[![NuGet](https://img.shields.io/nuget/v/Myvas.AspNetCore.Authentication.QQConnect.svg)](https://www.nuget.org/packages/Myvas.AspNetCore.Authentication.QQConnect)\r\n\r\n* WeixinOpen （微信开放平台/微信扫码登录）: _this repo_\r\n\r\n[![GitHub (Pre-)Release Date](https://img.shields.io/github/release-date-pre/myvas/AspNetCore.Authentication.WeixinOpen?label=github)](https://github.com/myvas/AspNetCore.Authentication.WeixinOpen)\r\n[![test](https://github.com/myvas/AspNetCore.Authentication.WeixinOpen/actions/workflows/test.yml/badge.svg)](https://github.com/myvas/AspNetCore.Authentication.WeixinOpen/actions/workflows/test.yml)\r\n[![deploy](https://github.com/myvas/AspNetCore.Authentication.WeixinOpen/actions/workflows/publish.yml/badge.svg)](https://github.com/myvas/AspNetCore.Authentication.WeixinOpen/actions/workflows/publish.yml)\r\n[![NuGet](https://img.shields.io/nuget/v/Myvas.AspNetCore.Authentication.WeixinOpen.svg)](https://www.nuget.org/packages/Myvas.AspNetCore.Authentication.WeixinOpen)\r\n\r\n* WeixinAuth （微信公众号/公众号内静默登录）: [Here](https://github.com/myvas/AspNetCore.Authentication.WeixinAuth)\r\n\r\n[![GitHub (Pre-)Release Date](https://img.shields.io/github/release-date-pre/myvas/AspNetCore.Authentication.WeixinAuth?label=github)](https://github.com/myvas/AspNetCore.Authentication.WeixinAuth)\r\n[![test](https://github.com/myvas/AspNetCore.Authentication.WeixinAuth/actions/workflows/test.yml/badge.svg)](https://github.com/myvas/AspNetCore.Authentication.WeixinAuth/actions/workflows/test.yml)\r\n[![deploy](https://github.com/myvas/AspNetCore.Authentication.WeixinAuth/actions/workflows/publish.yml/badge.svg)](https://github.com/myvas/AspNetCore.Authentication.WeixinAuth/actions/workflows/publish.yml)\r\n[![NuGet](https://img.shields.io/nuget/v/Myvas.AspNetCore.Authentication.WeixinAuth.svg)](https://www.nuget.org/packages/Myvas.AspNetCore.Authentication.WeixinAuth)\r\n\r\n## What's this?\r\nAn ASP.NET Core authentication middleware for https://open.weixin.qq.com (微信开放平台/微信扫码登录)\r\n* 须微信开放平台(open.weixin.qq.com)账号。\r\n* 用户可使用微信扫码并确认后登入网站。\r\n\r\n## How to Use?\r\n### 0.创建微信开放平台账号，创建并配置一个应用（移动应用、网站应用、公众号、小程序等）\r\n在微信开放平台(https://open.weixin.qq.com)上创建网站应用，获取“APPID”和“AppSecret”，并配置【授权回调域】。建议同时配置业务域名。\r\n- 【授权回调域】（例如：wx.myvas.com)\r\n  - 在该域名下部署的网站可以使用本组件进行身份验证。\r\n  - 可以在多个虚拟目录下同时部署多个网站。\r\n  - 该项配置的域名是确定的，不会通配到本域名下的二级子域名上生效。\r\n  - 该项配置不限定协议，您可以采用HTTP或HTTPS都行。\r\n  - 配置中的CallbackPath可以直接使用默认配置。因为它的“根”是您的网站部署的地址，这个地址已经包含虚拟目录（如果有），因此，基本上不太可能与您的网站中已有网页路由地址冲突。\r\n- 【业务域名】（例如：https://wx.myvas.com）\r\n  - 部署在该域名下的网站，可以使用本组件验证后的身份去访问任意PC小程序和分享小程序。\r\n  - 业务域名必须指定协议，最多只能指定3个业务域名。\r\n\r\n（如图所示）\r\n\u003cimg alt=\"微信开放平台-配置-网站应用-开发配置\" src=\"./docs/img/weixinopen-options.png\" /\u003e\r\n\r\n### 1.在您的程序中引用NuGet包\r\n* [Myvas.AspNetCore.Authentication.WeixinOpen](https://www.nuget.org/packages/Myvas.AspNetCore.Authentication.WeixinOpen)\r\n\r\n### 2.在您的程序中配置服务（ConfigureServices）\r\n```csharp\r\nservices.AddAuthentication()\r\n    // using Myvas.AspNetCore.Authentication;\r\n    .AddWeixinOpen(options =\u003e \r\n    {\r\n        options.AppId = Configuration[\"WeixinOpen:AppId\"];\r\n        options.AppSecret = Configuration[\"WeixinOpen:AppSecret\"];\r\n\r\n        options.CallbackPath = \"/signin-weixinopen\"; //默认\r\n    };\r\n```\r\n\r\n### 3.在您的程序中使用身份验证（ConfigurePipeline）\r\n\r\n```csharp\r\n    app.UseAuthentication();\r\n```\r\n\r\n### 4.在您的程序中触发身份验证组件（自动触发或在登陆页中放个链接）\r\n\r\n## 其他说明\r\n\r\n1. 同一用户在同一微信公众号即使重复多次订阅/退订，其OpenId也不会改变。\r\n2. 同一用户在不同微信公众号中的OpenId是不一样的。\r\n3. 若同时运营了多个微信公众号，可以在微信开放平台上开通开发者账号，并在“管理中心/公众账号”中将这些公众号添加进去，就可以获取到同一用户在这些公众号中保持一致的UnionId。\r\n\r\n# For Developers\r\n* [Visual Studio Code](https://code.visualstudio.com)\r\n* [Visual Studio 2022](https://visualstudio.microsoft.com)\r\n* [.NET Core 3.1](https://dotnet.microsoft.com/download/dotnet-core/3.1)\r\n* [.NET 5.0](https://dotnet.microsoft.com/download/dotnet-core/5.0)\r\n* [.NET 6.0](https://dotnet.microsoft.com/download/dotnet-core/6.0)\r\n* [.NET 7.0](https://dotnet.microsoft.com/download/dotnet-core/7.0)\r\n* [.NET 8.0](https://dotnet.microsoft.com/download/dotnet-core/8.0)\r\n* [.NET 9.0](https://dotnet.microsoft.com/download/dotnet-core/9.0)\r\n* [微信开发者工具](https://mp.weixin.qq.com/debug/wxadoc/dev/devtools/download.html)\r\n* [微信开放平台](https://open.weixin.qq.com)\r\n\r\n# Demo\r\n* https://wx.myvas.com\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmyvas%2Faspnetcore.authentication.weixinopen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmyvas%2Faspnetcore.authentication.weixinopen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmyvas%2Faspnetcore.authentication.weixinopen/lists"}