【问题标题】:Google OAuth 2.0 Response谷歌 OAuth 2.0 响应
【发布时间】:2019-07-09 15:33:01
【问题描述】:

我需要帮助弄清楚为什么我的 OAuth 2.0 响应总是这样:

https://accounts.google.com/o/oauth2/approval?as=[一堆字母和数字]&xsrfsign=[一堆字母和数字]

这是我登录 Google 帐户并单击允许访问应用程序后的响应。

根据文档 (http://code.google.com/apis/accounts/docs/OAuth2WebServer.html#handlingtheresponse),这与我期望的响应完全不同

【问题讨论】:

    标签: oauth-2.0


    【解决方案1】:

    首先,您没有指定要编码的语言。

    其次,确保指定正确的 RedirectUri。您可以从 google 控制台 (https://code.google.com/apis/console/) 获取或设置 if。

    那么,对于这种 url https://accounts.google.com/o/oauth2/approval?as=.....&xsrfsign=..... 你不会从 url 中获取授权码,而是从页面内容中获取授权码:

    我已经从页面的原始代码中提取出来了:[C#代码]

    string []s=webBrowser1.Document.ActiveElement.InnerHtml.Split (new string [] {"value=\"", "\""}, StringSplitOptions.None);
    string authCode=s[165];
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-05-07
      • 2015-02-14
      • 2017-07-31
      • 2015-08-08
      • 1970-01-01
      • 1970-01-01
      • 2021-07-20
      相关资源
      最近更新 更多