Facebook Test User API登录URL是否正常工作 [英] Facebook Test User API login url working or not randomly

查看:117
本文介绍了Facebook Test User API登录URL是否正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我编写了一个桌面应用程序,其中包含FB应用程序数据并列出测试用户. 我想用新的配置文件打开浏览器(浏览器配置文件,而不是FB,因为要解决PHP facebook API中的会话问题-我希望不在我所在域的应用程序会话中.)

I have wrote a desktop app, that holds FB applications data and lists test users. I want to open a browser with new profile (browser profile, not FB, because to session problems in PHP facebook API - I want to be not in my a app session on my domain).

但是问题是,Facebook登录URL是否正常工作或不能正常工作. 我已经尝试过Firefox&铬合金.

But the problem is, that facebook login URL is working or not randomly. I have tried Firefox & Chrome.

具有-no-remote-p "RANDOM_PROFILE"-CreateProfile的Firefox,然后在执行之前执行以打开具有该配置文件的url.

Firefox with -no-remote, -p "RANDOM_PROFILE", and also -CreateProfile executing before execution to open url with that profile.

使用--profile-directory="RANDOM_DIR"的Chrome(先前创建的目录).

Chrome with --profile-directory="RANDOM_DIR" (directory created earlier).

管理浏览器配置文件在两种浏览器中均能正常工作.但是在大多数情况下,使用Facebook Test User登录URL打开浏览器只会将我重定向到主页.

Managing browser profiles works good in both browser. But in most cases, opening browser with Facebook Test User login URL, just redirects me to main page.

此外,我已经创建了一些PHP页面:

Also, i have created a some PHP pages:

  • 过一会儿重定向通过window.location登录URL
  • 睡眠后通过标题("Location:...")重定向到登录网址的一个
  • 一个带有<a href...>标记的网址.
  • one redirecting after a while to login URL by window.location
  • one redirecting after a sleep by header('Location: ...') to login url
  • one with <a href...> tag to login url.

第三种方法是唯一可行的方法,但是它在大约20%的情况下有效(有时在该链接上单击多次并在新标签页中多次打开是可行的)

Third option is the only one working, but it works in about 20% cases (sometimes clicking many times on that link & opening multiple times in new tabs is working)

如何使用Facebook登录URL启动新的浏览器实例,从而使日志记录工作正常?

How to do launch of a new browser instance with facebook login URL where loging works fine ?

我的登录URL总是在尝试登录之前不久就从FB获取的,因此它们不会过期.

my loging URL's are always fetched from FB very shortly before login try, so they aren't expired.

推荐答案

我终于明白了.

问题在于,必须至少加载一次 http://facebook.com Cookie)),然后再使用测试用户"登录URL.

The problem is, that http://facebook.com must be loaded at least one time (propably for setting some cookies) before using Test User login URL.

因此,我使用脚本在iframe中打开Facebook,然后一段时间后重定向到登录网址:

So, i use a script to open the Facebook in iframe, and then after some time redirects to login url:

<script>
setTimeout(function(){
window.location = "<?php echo $_GET['url']; ?>";
} , 2000 );
</script>
<iframe src="http://facebook.com/"></iframe>

请注意,iframe上的Facebook将仅作为head + body加载空白页面,但这是可行的.

Notice that facebook on iframe will load as head+body only blank page, but this is working.

然后,您可以使用此脚本通过将其传递到Chrome命令行并将URL编码的Test-User-Login-URL作为'url'GET参数来登录Test User.

Then you can use this script to login Test User by passing it to Chrome command line, with url-encoded Test-User-Login-URL as 'url' GET parameter.

将新创建的目录用​​于chrome配置文件,以避免在您的应用域上出现旧会话.

Use fresh created directory for chrome profile to avoid getting old session on your app domain.

此外,我建议使用以下参数:--start-maximized--no-default-browser-check--no-first-run

Also, I suggest using arguments: --start-maximized, --no-default-browser-check, --no-first-run

更新:请注意,请求的登录URL只能使用此方法运行一次(可能还有其他任何方法-未选中)

UPDATE: Notice that requested login URL will work only once with this method (and maybe any other methods - didn't checked)

这篇关于Facebook Test User API登录URL是否正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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