china-live / QQConnect

asp.net core2.0 QQ和微信登录
BSD 3-Clause "New" or "Revised" License
282 stars 78 forks source link

微信登录在.NET CORE3.1下id4启动就报错。 #14

Open codeman-git opened 4 years ago

codeman-git commented 4 years ago

image 按照demo一猫一样写的,id4一起动就报错,把addwechat段删掉就没事了。

An unhandled exception occurred while processing the request. MissingMethodException: Method not found: 'Void Microsoft.AspNetCore.Authentication.ClaimActionCollectionMapExtensions.MapCustomJson(Microsoft.AspNetCore.Authentication.OAuth.Claims.ClaimActionCollection, System.String, System.Func`2<Newtonsoft.Json.Linq.JObject,System.String>)'. Microsoft.AspNetCore.Authentication.WeChat.WeChatOptions..ctor()

loundar commented 4 years ago

同问,也是升级的时候遇到了这个问题,明明存在,却提示这个,感觉莫名其妙,求大神解答

codeman-git commented 4 years ago

https://github.com/aspnet-contrib/AspNet.Security.OAuth.Providers nuget上提供的哪些都有问题,上面的地址里面提供的都可以用。

codeman@foxmail.com

发件人: lonewolf 发送时间: 2020-04-18 14:51 收件人: china-live/QQConnect 抄送: codeman-git; Author 主题: Re: [china-live/QQConnect] 微信登录在.NET CORE3.1下id4启动就报错。 (#14) 同问,也是升级的时候遇到了这个问题,明明存在,却提示这个,感觉莫名其妙,求大神解答 — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

Yukimir commented 4 years ago

这是因为.net core 3.1的asp.net core做了一些修改 具体在 OAuthTokenResponse.Success这个方法 和 new OAuthCreatingTicketContext的构造函数 上 在.net core 2当中这两个方法接受的参数是一个JObject 而.net core 3当中这两个方法接受的参数是一个JsonDocument 因为在.net core 3里微软不再使用JSON.NET作为JSON解析库,而是用自己的了

另外 wechat的库在options里还用了一个MapCustomJson 这里的委托传入的参数也一样改掉了

所以可以简单的fork一下然后在Options和Handler里面做一下条件编译

robin8588 commented 4 years ago

很棒的项目,期待能在 .net core 3 里面使用