Facebook Connect Ping与重定向网址? [英] Facebook Connect Ping vs. Redirect URL?

查看:133
本文介绍了Facebook Connect Ping与重定向网址?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Facebook连接工作方式几乎在我的网站上需要,我需要解决几个bug,下面是从facebook连接的文件,它列出了3个不同的URL选项,在FB连接的设置中。这对我来说可能是非常有用的,因为当用户在Facebook上第一次登录我的网站时,我需要在Facebook上创建具有配置文件数据的mysql配置文件。

I almost have facebook connect working the way I need it on my site, I need to work out a couple bugs still, below is from the facebook connect documents, it list the 3 different URL options below in the settings of FB connect. This could be very useful for me because when a user logs in for the 1st time on my site with facebook, I need to create there mysql profile with profile data from facebook.

好吧,我有点困惑,我明白一个重定向网址只是将浏览器重定向到一个页面,但是你可以看到我下面保存的其中2个链接是为了回调网址,所以我把它的facebook发布数据到我提供的URL?如果我是正确的,我该怎么知道在平安发回的数据?

Ok so I am a bit confused, I understand a Redirect URL just redirects the browser to a page but you can see that 2 of these links I save below are for a Callback URL, so I take it that facebook post data to the URL's I provide? If I am correct, how can I know what data it post back in the Ping?

1)


授权回拨URL:当用户第一次授权
时,Facebook
会发送此URL。
您还可以将users.isAppUser调用
确定用户是否已经为您的应用程序授权

Post-Authorize Callback URL: Facebook pings this URL when a user authorizes your application for the first time. You can also call users.isAppUser to determine if the user has authorized your application.

2)


授权重定向网址:您可以
将用户重定向到
用户首次授权您的应用程序
后的URL。只有当用户通过login.php授权您的
应用程序,而不是
登录对话框时,才可以使用此URL

Post-Authorize Redirect URL: You can redirect a user to this URL after the user authorizes your application for the first time. You can use this URL only if the user authorizes your application through login.php and not the login dialog.

3)


删除回拨网址:当用户删除您的
应用程序时,Facebook
发送URL。

Post-Remove Callback URL: Facebook pings the URL when a user removes your application.



< hr>

当用户在浏览器中重定向时,我可以运行这样的代码,从Facebook获取个人资料,但我不知道什么时候Facebook ping数据?


When the user redirects in the browser I can run code like this to get there profile data from facebook but I am not sure about when facebook pings data?

$user_details=$fb->api_client->users_getInfo($fb_user, array('last_name', 'first_name', 'proxied_email','birthday_date', 'sex', 'is_app_user', 'current_location', 'about_me', 'activities', 'interests', 'relationship_status', 'pic_big', 'pic_small', 'books'));  

$firstName = $user_details[0]['first_name']; 
.....


推荐答案

不要以为我完全可以理解你的问题,所以我会尽量回答我能做的 - 如果有什么不好,请在这里发表评论,然后我会相应地编辑答案。

I don't think I completelly understand your question, so I'll try to answer what I can - if there's anything missing, please comment here and I'll edit the answer accordingly.

你假设Facebook在ping时发送POST数据。所以,基本上你在端点上做什么(你告诉Facebook来ping的url)是读取你想要的数据的 $ _ REQUEST dict。 Facebook上发送的每个参数的列表可以在 here 找到。

You're right assuming that Facebook sends POST data when pinging. So, basically what you'd do on the endpoint given (the url you told facebook to ping) is to read the $_REQUEST dict for the data you want. A list of every parameter Facebook sends on ping can be found here.

将会发生以下情况:


  1. 用户点击与您的使用Facebook连接的网站

  2. Facebook登录页面向用户显示确认是否允许此操作

  3. 如果<允许,Facebook将POST数据发送到指定的URL asap

同样的情况发生在用户删除您自己通过Facebook Connect从您的网站。

The same happens when the user removes herself from your site through Facebook Connect.

请注意,您应该仔细验证端点上收到的数据。由于您在每个帖子请求中创建持久性数据,因此至少确保只能从Facebook收到请求。

Please note that you should validate carefully the data received on your endpoint. Since you're creating persistent data on every post request, at least ensure the requests can only be received from facebook.

或者,您可以只需将用户重定向到授权后的某个地方,请调用 users_getInfo 并检查 is_app_user 是否为true。如果是,您继续在数据库上创建实体。

Alternatively, you can just redirect the user somewhere after the authorization, call users_getInfo and check if is_app_user is true. If so, you go on creating your entities on your database.

这篇关于Facebook Connect Ping与重定向网址?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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