redirect_uri_mismatch 请求中的重定向 URI 与 OAuth 客户端授权的重定向 URI 不匹配 [英] redirect_uri_mismatch the redirect URI in the request does not match the ones authorized for the OAuth client

查看:104
本文介绍了redirect_uri_mismatch 请求中的重定向 URI 与 OAuth 客户端授权的重定向 URI 不匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下客户端密码

{
  "web": {
    "client_id": "testid",
    "project_id": "testproj",
    "auth_uri": "https://accounts.google.com/o/oauth2/auth",
    "token_uri": "https://www.googleapis.com/oauth2/v3/token",
    "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
    "client_secret": "test-sec",
    "redirect_uris": [
      "https://localhost:8080/oauth2callback"
    ]
  }
}

我得到了

错误:redirect_uri_mismatch请求中的重定向 URI http://127.0.0.1:8414/authorize/与 OAuth 客户端授权的不匹配.

"Error: redirect_uri_mismatch The redirect URI in the request, http://127.0.0.1:8414/authorize/, does not match the ones authorized for the OAuth client.

要更新授权的重定向 URI,请访问:.请您提出建议,如何解决它.

To update the authorized redirect URIs, visit:". Could you please suggest, how to fix it.

我正在使用 C#.我已经用这个创建了凭据 -

I am using C#. I have created credentials with this -

GoogleWebAuthorizationBroker.AuthorizeAsync( GoogleClientSecrets.Load(stream).Secrets, scopes,
                                             "user",
                                              CancellationToken.None, 
                                              new FileDataStore(Directory.GetCurrentDirectory() + "\AccessToken\" , 
                                             true)).Result; 

但第一次,它弹出登录,一旦我登录,它在文件夹中创建了 Google.Apis.Auth.OAuth2.Responses.TokenResponse-user 文件.有没有办法绕过第一次登录?

But for first time , it popped up with login and once I logged in , it has created Google.Apis.Auth.OAuth2.Responses.TokenResponse-user file in the folder. Is there a way to bypass first time login ?

谢谢.

推荐答案

我只是在添加为授权重定向 URL 时忽略了错误消息中的端口.

I just ignored the port in the error message when adding as an Authorized redirect URL.

 http://127.0.0.1/authorize/

这篇关于redirect_uri_mismatch 请求中的重定向 URI 与 OAuth 客户端授权的重定向 URI 不匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆