AspNet.Security.OAuth.Providers icon indicating copy to clipboard operation
AspNet.Security.OAuth.Providers copied to clipboard

add wechat official account providers.

Open mrhoun opened this issue 1 year ago • 1 comments

https://developers.weixin.qq.com/doc/offiaccount/en/OA_Web_Apps/Wechat_webpage_authorization.html

mrhoun avatar Jul 20 '23 03:07 mrhoun

It seems that the current AspNet.Security.OAuth.Weixin should support your requirement, as long as you use the specific official account options instead of default ones.

After a quick check of mine, as least you should write the following codes for example,


AuthenticationBuilder builder = services.AddAuthentication();

builder.AddWeixin(opt => 
{
    // NOT use the default, "https://open.weixin.qq.com/connect/qrconnect"
    opt.AuthorizationEndpoint = "https://open.weixin.qq.com/connect/oauth2/authorize";
    // opt.Scope.Clear();
    opt.Scope.Add("snsapi_base");
    opt.Scope.Add("snsapi_userinfo");
});

You may have to take a try first. The source codes are not very complex, so you can even copy and debug them in your project if you meet other problems. Your feedback is welcomed.

BTW, adding a provider needs a careful decision and basically you won't expect someone else to make it.

LeaFrock avatar Aug 02 '23 05:08 LeaFrock