Asp.net mvc 4 Google身份验证重定向\u uri\u不匹配错误

Asp.net mvc 4 Google身份验证重定向\u uri\u不匹配错误,asp.net-mvc-4,google-api,google-oauth,google-developers-console,Asp.net Mvc 4,Google Api,Google Oauth,Google Developers Console,我已经检查了所有其他人可能的解决方案,并应用于我的应用程序设置或代码中,但对我来说没有任何效果 下面是我传递给baseUrl的参数https://accounts.google.com/o/oauth2/auth 范围:https://www.googleapis.com/auth/plus.login https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile

我已经检查了所有其他人可能的解决方案,并应用于我的应用程序设置或代码中,但对我来说没有任何效果

下面是我传递给baseUrl的参数
https://accounts.google.com/o/oauth2/auth

  • 范围:
    https://www.googleapis.com/auth/plus.login https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile
  • 客户端id:
    xxxxxxxx.apps.googleusercontent.com
  • 重定向\u uri:
    http://localhost:8228/Auth/ExternalLoginCallback?__provider__=Google&__sid__=xxxxxxxxxxxxxxxxxxxx
  • 状态:
    xxxxxxxxxxxxxxxxx
  • 响应类型:
    code
  • 访问类型:
    联机
我错过了什么?请任何人给我提些建议

每次我都会遇到以下错误:

这是我的应用程序信息:

更新1:

以下是我为谷歌的
RequestAuthentication
方法类编写的代码:

public GoogleScopedClient(string cleintId, string clientSecretId)
        {
            this.cleintId = cleintId;
            this.clientSecretId = clientSecretId;
        }

        public string ProviderName
        {
            get { return "Google"; }
        }

        public void RequestAuthentication(System.Web.HttpContextBase context, Uri returnUrl)
        {
             string state = Regex.Match(returnUrl.AbsoluteUri, "(?<=__sid__=).*?($|&)", RegexOptions.IgnoreCase).Value;

            string url = baseUrl + HttpUtility.UrlEncode(SCOPE.ToString()) +
                "&client_id=" + cleintId + "&redirect_uri=" +HttpUtility.UrlEncode(returnUrl.ToString()) 
+"&response_type=code&access_type=online";
  context.Response.Redirect(url);
        }
publicGoogleScopedClient(字符串cleintId,字符串clientSecretId)
{
this.cleintId=cleintId;
this.clientSecretId=clientSecretId;
}
公共字符串提供程序名
{
获取{返回“谷歌”;}
}
public void RequestAuthentication(System.Web.HttpContextBase上下文,Uri returnUrl)
{

string state=Regex.Match(returnUrl.AbsoluteUri),(?您的重定向URI不匹配。具体来说,您在Google开发者控制台中指定的是
http://localhost:8228/Auth/ExternalLoginCallback/
,但发送的是
http://localhost:8228/Auth/ExternalLoginCallback
(不带尾随斜杠)。这实际上是两个完全不同的URL,尽管它们通常位于同一个位置。

您在请求详细信息中得到了什么?。通过查看此内容,我可以猜到您遗漏了什么。请提交您的代码以便我们可以看到您在做什么。@DaImTo请查看
更新1
。我添加了
RequestAuth诱惑
来自我的代码。很抱歉,这不是谷歌的官方.Net代码。我对其他Oauth库的经验很少,因此我不会提供任何帮助。我建议您挂断,等待其他人帮助您。请记住,您发送的重定向URI必须与您在谷歌开发者控制台中输入的内容完全匹配否则服务器将返回您现在的错误。请检查您在returnURL中的内容。@DaImTo没问题,谢谢您的建议!!:)实际上,我已经在
注册客户端下创建了一个名为“GoogleScopedClient”的类。因此,我在谷歌api登录时就是这样工作的。是的,我肯定会检查返回URL!!我已经从谷歌开发者控制台删除了
/
,但它显示了相同的错误。