我在MVC项目中使用了Oauth2
。我们可以使用凭据成功连接到我们的应用程序,但在验证用户身份后,在外部登录回调方法中始终返回null。
检查了许多解决方案,但没有运气,但另一个登录可以像Facebook一样正常工作。
对于此集成,我在应用程序中使用了Microsoft.Owin 4.0.0
版本。
经过很长时间,我终于得到了解决方案。
在ConfigureAuth(IAppBuilder app)
函数的Startup.cs
文件中添加此行。与以下代码相同。
public void ConfigureAuth(IAppBuilder app)
{
//Add this line at first inside the function.
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
//Other code
}