Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/30.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
c#,ASP.net与MVC5.0-谷歌认证问题_C#_Asp.net_Asp.net Mvc - Fatal编程技术网

c#,ASP.net与MVC5.0-谷歌认证问题

c#,ASP.net与MVC5.0-谷歌认证问题,c#,asp.net,asp.net-mvc,C#,Asp.net,Asp.net Mvc,我已经设法用webforms连接到GoogleAPi,但是MVC有问题 In theStart.Auth i have put in the following code : app.UseGoogleAuthentication(new GoogleOAuth2AuthenticationOptions() { ClientId = "6050764343-4ulkmfai2sp2bs.apps.googleusercontent.com", ClientSecre

我已经设法用webforms连接到GoogleAPi,但是MVC有问题

In theStart.Auth i have put in the following code :


 app.UseGoogleAuthentication(new GoogleOAuth2AuthenticationOptions()
    {
    ClientId = "6050764343-4ulkmfai2sp2bs.apps.googleusercontent.com",
   ClientSecret = "oDBLHfuU9GTqp9Chcz",
   CallbackPath = new PathString("/Account/ExternalLoginCallback")
        });
获取以下错误 请求中的重定向URI与为OAuth客户端授权的URI不匹配

我已尝试添加以下内容在Route.coinfig中添加相同问题

    //routes.MapRoute(
    //name: "signin-google",
    //url: "signin-google",
    //defaults: new { controller = "Account", action = "ExternalLoginCallback" });

   also tried commenting out the line below ...when i added the route map.
   CallbackPath = new PathString("/Account/ExternalLoginCallback")
        });

如果您有任何见解,我们将不胜感激。。。谢谢

您可以通过 及
对于外部登录,您只需要添加ClientId和ClientSecret。另请参见本文代码

我希望这能帮助那些因为没有检查默认actionName(在我的例子中是…)而四处奔波的人
ExternalLoginCallback。
一旦我改变了,一切都正常了

请尝试此CallbackPath=new PathString(“/signin google”),无需更改路由配置中的任何内容谢谢您的回复。。我试着去看那篇文章,但仍然犯了那个错误。。。请求中的重定向URI与为OAuth客户端授权的URI不匹配。