简体   繁体   English

WP7 WebBrowser的页面重定向(在Flickr上)问题

[英]Page redirection (on Flickr) issue for WP7 WebBrowser

I am having some difficulties with the OAuth authentication process with Flickr in the WP7 Mango WebBrowser control. 在WP7 Mango WebBrowser控件中的Flickr进行OAuth身份验证过程中,我遇到了一些困难。 After for example "Google" sign in the browser gets redirected to the following page: 例如,在“ Google”登录后,浏览器将重定向到以下页面:

<html xmlns="http://www.w3.org/1999/xhtml">
<head></head>
<body dir="" onload="document.forms['f'].submit();">
  <form id="f" method="POST" name="f" action="https://open.login.yahoo.com/openid/yrp/return_to?sid=0cbf1840b0b13c261235">
  <input name="openid.ns" value="http://specs.openid.net/auth/2.0" type="hidden">
  <input name="openid.mode" value="id_res" type="hidden">
  <input name="openid.op_endpoint" value="https://www.google.com/accounts/o8/ud" type="hidden">
  <input name="openid.response_nonce" value="2011-09-14T10:16:07Zsdv-LClYH0A" type="hidden">
  <input name="openid.return_to" value="https://open.login.yahoo.com/openid/yrp/return_to?sid=e7578b76a72f0c261235" type="hidden">
  <input name="openid.assoc_handle" value="AOQobUfPBfylWt9AYvILwR347CMGMjh2j4b5jlHe175juowtl05" type="hidden">
  <input name="openid.signed" value="op_endpoint,claimed_id,identity,return_to,response_nonce,assoc_handle,ns.ext1,ns.ext2,ext1.mode,ext1.type.fn,ext1.value.fn,ext1.type.gid,ext1.value.gid,ext1.type.em,ext1.value.em,ext1.type.lg,ext1.value.lg,ext1.type.ln,ext1.value.ln,ext2.auth_time,ext2.auth_policies" type="hidden">
  <input name="openid.sig" value="e5HFSrO0P+yeRJstJHGJlROUkDvVIDGU=" type="hidden">
  <input name="openid.identity" value="https://www.google.com/accounts/o8/id?id=AItOawlmDnO3Bct_YhZlwXpAsU" type="hidden">
  <input name="openid.claimed_id" value="https://www.google.com/accounts/o8/id?id=AItOawnO3Bct_YhZlVBwXpAsU" type="hidden">
  <input name="openid.ns.ext1" value="http://openid.net/srv/ax/1.0" type="hidden">
  <input name="openid.ext1.mode" value="fetch_response" type="hidden">
  <input name="openid.ext1.type.fn" value="http://axschema.org/namePerson/first" type="hidden">
  <input name="openid.ext1.value.fn" value="John" type="hidden">
  <input name="openid.ext1.type.gid" value="http://www.google.com/accounts/api/federated-login/id" type="hidden">
  <input name="openid.ext1.value.gid" value="837487387483142978" type="hidden">
  <input name="openid.ext1.type.em" value="http://axschema.org/contact/email" type="hidden">
  <input name="openid.ext1.value.em" value="john.doe@gmail.com" type="hidden">
  <input name="openid.ext1.type.lg" value="http://axschema.org/pref/language" type="hidden">
  <input name="openid.ext1.value.lg" value="en-US" type="hidden">
  <input name="openid.ext1.type.ln" value="http://axschema.org/namePerson/last" type="hidden">
  <input name="openid.ext1.value.ln" value="Doe" type="hidden">
  <input name="openid.ns.ext2" value="http://specs.openid.net/extensions/pape/1.0" type="hidden">
  <input name="openid.ext2.auth_time" value="1970-01-01T00:21:55Z" type="hidden">
  <input name="openid.ext2.auth_policies" value="http://schemas.openid.net/pape/policies/2007/06/none" type="hidden">
  <input name="openid.ns.ext3" value="http://specs.openid.net/extensions/ui/1.0" type="hidden">
  <input name="openid.ext3.mode" value="popup" type="hidden">
  <noscript><input value="Continue to open.login.yahoo.com" type="submit"></noscript>
  </form>
</body>
</html>

When the browser has loaded the page i just see the very small button with the text "Continue to open.login.yahoo.com" which in my opinion is not that user friendly. 当浏览器加载页面后,我仅看到带有文本“ Continue to open.login.yahoo.com”的非常小的按钮,我认为这不是那么用户友好。 Now you guys might think i didnt test with the IsScriptEnabled="True". 现在你们可能会认为我没有使用IsScriptEnabled =“ True”进行测试。 With the IsScriptEnabled="True" it just hides the button and shosw a blank page. 使用IsScriptEnabled =“ True”,它仅隐藏按钮并显示空白页面。

I have also tried using the InvokeScript method inorder to run document.forms['f'].submit(), but i just recieve a COM-exception in the application. 我也尝试过使用InvokeScript方法来运行document.forms ['f']。submit(),但我只是在应用程序中收到COM异常。

Please help! 请帮忙! Any tips or suggestions? 有任何提示或建议吗?

I have been pulling my hair with this problem but it seems that there has been made some changes in the WebBrowser control. 我一直在努力解决这个问题,但似乎WebBrowser控件已进行了一些更改。

I just activate IsScriptEnabled="True" and it seems to trigger the form post. 我只是激活IsScriptEnabled =“ True”,它似乎触发了表单发布。 However before that i tried some other methods that seemed to work, one being: 但是在此之前,我尝试了一些其他可行的方法,其中一种是:

loginBrowser.InvokeScript("eval", "document.forms[0].submit()");

However i came across another problem with one of the last redirects. 但是我遇到了最后一个重定向之一的另一个问题。 A GET to the following, i guess it´s where we get the signature and link that we need inorder to authorize the app for our Flickr account (the link below was shortened and is non-functional). 对于以下内容的获取,我想这是我们获得签名和链接所必需的,以便为Flickr帐户授权该应用程序(以下链接已缩短且不起作用)。

GET /signin/yahoo/?redir=%2Fservices%2Fauth%2F%3Fmobile%3D6%26api_key%3D40d26ecdfghDhr4a1f62219c68d989df%26perms%3Dwrite%26api_sig%3Dcda4de52d6eca8e6db565cf8cd52e1f4&.data=Lnlp......

The solution was the following: 解决方案如下:

private void loginBrowser_Navigating(object sender, NavigatingEventArgs e)
        {
            if (e.Uri.ToString().Contains("http://www.flickr.com/signin/yahoo/?redir=/services/auth/?mobile=1") && _ishit == false)
            {
                _ishit = true;
                e.Cancel = true;

            }
        }

I hope this helps someone! 我希望这可以帮助别人!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM