2011-12-29 103 views
0

我需要帮助搞清楚为什么我的OAuth 2.0回应始终是一样的东西:谷歌的OAuth 2.0效应初探

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

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

这一点也不像我根据文档(http://code.google.com/apis/accounts/docs/OAuth2WebServer.html#handlingtheresponse)

回答

0

首先期待的反应,你做未指定您正在编码的语言。

其次,确保你指定corect RedirectUri。您可以从Google控制台获取或设置(https://code.google.com/apis/console/)。 enter image description here

我从原始代码中提取它:

然后,这种URL https://accounts.google.com/o/oauth2/approval?as=.....&xsrfsign=的.....你不会从URL,但是从页面的内容获取授权码的页面:[C#code]

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