{"id":24494658,"url":"https://github.com/myvas/aspnetcore.authentication.weixinauth","last_synced_at":"2025-04-05T22:08:09.322Z","repository":{"id":34362683,"uuid":"177928593","full_name":"myvas/AspNetCore.Authentication.WeixinAuth","owner":"myvas","description":"An ASP.NET Core authentication middleware: WeixinAuth for https://mp.weixin.qq.com （微信公众平台/网页授权登录）","archived":false,"fork":false,"pushed_at":"2025-02-24T18:42:53.000Z","size":2498,"stargazers_count":40,"open_issues_count":4,"forks_count":12,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-05T22:07:45.699Z","etag":null,"topics":["aspnet","aspnetcore","authentication","authentication-middleware","middleware","myvas","netcoreapp30","netstandard20","nuget","oauth2","weixin","weixinauth"],"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-27T06:05:37.000Z","updated_at":"2025-02-18T10:47:25.000Z","dependencies_parsed_at":"2025-02-27T09:23:38.254Z","dependency_job_id":"665a298d-1451-42c8-b3db-c0f9fe8d7eae","html_url":"https://github.com/myvas/AspNetCore.Authentication.WeixinAuth","commit_stats":null,"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/myvas%2FAspNetCore.Authentication.WeixinAuth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/myvas%2FAspNetCore.Authentication.WeixinAuth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/myvas%2FAspNetCore.Authentication.WeixinAuth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/myvas%2FAspNetCore.Authentication.WeixinAuth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/myvas","download_url":"https://codeload.github.com/myvas/AspNetCore.Authentication.WeixinAuth/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247406090,"owners_count":20933803,"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":["aspnet","aspnetcore","authentication","authentication-middleware","middleware","myvas","netcoreapp30","netstandard20","nuget","oauth2","weixin","weixinauth"],"created_at":"2025-01-21T20:16:37.595Z","updated_at":"2025-04-05T22:08:09.294Z","avatar_url":"https://github.com/myvas.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Myvas.AspNetCore.Authentication Family\r\n\r\n* QQConnect: [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: [Here](https://github.com/myvas/AspNetCore.Authentication.WeixinOpen)\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: _this repo_\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\r\n# What's this?\r\nAn ASP.NET Core authentication middleware for https://mp.weixin.qq.com （微信公众平台/网页授权登录）\r\n* 须微信公众平台（mp.weixin.qq.com）已认证的服务号（或测试号）。\r\n* 用户可在微信客户端访问网站时自动登入网站。换而言之，用户在微信客户端中访问网页时，可以通过此组件Challenge获取用户的OpenId或UnionId，据此可以识别用户。\r\n\r\n# How to Use?\r\n## 0.Create account\r\n（1）在微信公众平台(https://mp.weixin.qq.com)上创建账号。\r\n\r\n微信公众平台/网页授权获取用户信息，须在微信公众平台（mp.weixin.qq.com）上开通服务号，并认证。  \r\n___注意：订阅号无网页授权权限，即使是已认证的订阅号也不行！___\r\n\r\n（2）配置功能权限：微信公众平台-已认证服务号/开发/接口权限/...\r\n- 开通功能：网页服务/网页授权获取用户基本信息。\r\n- 设置网页授权域名：例如，auth.myvas.com。\r\n- 将文件MP_verify_xxxxxxxxx.txt上传至`wwwroot`目录下。\r\n\r\n（3）当然，也可以在公众平台测试号上测试：微信公众平台-测试账号/开发/开发者工具/公众平台测试号/...\r\n- 开通功能：网页服务/网页授权获取用户基本信息。\r\n- 设置授权回调页面域名：例如，auth.myvas.com。\r\n\r\n## 1.nuget\r\n* [Myvas.AspNetCore.Authentication.WeixinAuth](https://www.nuget.org/packages/Myvas.AspNetCore.Authentication.WeixinAuth)\r\n\r\n## 2.Configure\r\n```csharp\r\n    app.UseAuthentication();\r\n```\r\n\r\n\r\n## 3.ConfigureServices\r\n```csharp\r\nservices.AddAuthentication()\r\n    // using Myvas.AspNetCore.Authentication;\r\n    .AddWeixinAuth(options =\u003e \r\n    {\r\n        options.AppId = Configuration[\"WeixinAuth:AppId\"];\r\n        options.AppSecret = Configuration[\"WeixinAuth:AppSecret\"];\r\n\r\n        options.SilentMode = false; // default is true\r\n    };\r\n```\r\n\r\n\r\n```\r\n说明：\r\n(1)同一用户在同一微信公众号即使重复多次订阅/退订，其OpenId也不会改变。\r\n(2)同一用户在不同微信公众号中的OpenId是不一样的。\r\n(3)若同时运营了多个微信公众号，可以在微信开放平台上开通开发者账号，并在“管理中心/公众账号”中将这些公众号添加进去，就可以获取到同一用户在这些公众号中保持一致的UnionId。\r\n```\r\n\r\n# Dev\r\n* [Visual Studio 2022](https://visualstudio.microsoft.com)\r\n* [.NET 9.0, 8.0, 7.0, 6.0, 5.0, 3.1](https://dotnet.microsoft.com/en-us/download/dotnet)\r\n* [微信开发者工具](https://mp.weixin.qq.com/debug/wxadoc/dev/devtools/download.html)\r\n\r\n# Demo\r\n* [Here](https://demo.auth.myvas.com)\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmyvas%2Faspnetcore.authentication.weixinauth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmyvas%2Faspnetcore.authentication.weixinauth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmyvas%2Faspnetcore.authentication.weixinauth/lists"}