facebook php API 的更多设置
也许我搜索的方式完全错误,而且我认为 Facebook 文档非常糟糕。
我想知道,我正在使用下面的设置连接到 facebook 并且有效(我能够检索登录用户的个人资料信息,允许我的应用程序访问他的个人资料。)是否还有其他我可以设置的选项,例如回调 url 和过期时间(我想将其设置为从不,这样我就可以将令牌保存在我的数据库中并重新使用它)?
这是现在的配置:
$facebook = new Facebook(array(
'appId' => 'xxxxxxxxxxxx',
'secret' => 'xxxxxxxxxxxx',
'cookie' => true
));
我还连接到 Twitter,我可以这样做:
$this->configTwitter = array(
'callbackUrl' => 'xxxxxxxxxxxx',
'siteUrl' => 'http://twitter.com/oauth',
'consumerKey' => 'xxxxxxxxxxxx',
'consumerSecret' => 'xxxxxxxxxxxx'
);
提前致谢!
Facebook 应该看看 Twitter
Maybe I searched completely in the wrong way, and the facebook documentation pretty much sucks in my opinion.
I was wondering, I'm connecting to facebook with the settings below and that works (I'm able to retrieve the profile information of the logged in user allows my application to access his profile.) Are there other options I can set, like the callback url and the expiration (which I want to set to never, so I can save the token in my db and re-use it)?
This is the config now:
$facebook = new Facebook(array(
'appId' => 'xxxxxxxxxxxx',
'secret' => 'xxxxxxxxxxxx',
'cookie' => true
));
I'm also connection to twitter and there I'm able to this:
$this->configTwitter = array(
'callbackUrl' => 'xxxxxxxxxxxx',
'siteUrl' => 'http://twitter.com/oauth',
'consumerKey' => 'xxxxxxxxxxxx',
'consumerSecret' => 'xxxxxxxxxxxx'
);
Thanks in advance!
Facebook should take a look at Twitter
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
经过几天的尝试,吐出 Graph OAuth 2.0 的文档(它的工作效果没有预期的那么好,并在互联网上搜索,我找到了一个解决方案,我用它来创建以下脚本:
这段代码工作得很好并且执行以下操作:
然后我将令牌存储在数据库中,这样我就不必再次请求它
现在你可以,如果你想使用facebook代码,或者你'重新编写自己的代码来获取用户数据或来自 facebook 的其他信息(确保您请求了正确的权限)
如果这是 facebook 有效的代码,现在不要这样做,但它工作得很好,我可以像我一样轻松定义“配置”通缉....
After trying a few days, spitting the documentation of the Graph OAuth 2.0 (which doesn't work as good as expected and searching the internet I found a solution which I used to create the following script:
This piece of code works great and performs the following actions:
I then store the token in the database so I won't have to request it again
Now you can, if you wish use the facebook code, or you're own code to get the users data, or other information from facebook (be sure you requested the right permissions)
Don't now if this is facebook-valid code, but it works great and I can easily define the 'config' like I wanted....