Facebook应用程序 - 新的应用程序用户的深层链接 [英] Facebook app - deep link for new app user

查看:150
本文介绍了Facebook应用程序 - 新的应用程序用户的深层链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

简短版本



我有一个Facebook iframe应用程序作为粉丝页面上的页面标签。该应用程序收集比赛的条目。它列出条目,并且还有一个显示单个条目的页面。我想要能够链接到单条目页面 - 我使用 app_data 参数进行工作,但只有在用户之前使用该应用程序。对于必须添加应用程序(登录)的新用户,这不起作用。



长版本



到目前为止,我已经设法通过链接到

  http://facebook.com/pages/< ; myPageName> /< myPageId> SK = APP_< myAppID>&安培; app_data文件= LT; myUrlEncodedJsonData> 

app_data 参数传递给我应用程序的iframe通过Facebook,然后我可以处理服务器端将用户重定向到相应的子页面。所有似乎都很好,但只有在尝试访问深层链接的内容之前,我已经登录到应用程序。



如果我尝试深入链接到单个入门页面,并没有安装应用程序(情景:我是参赛者的朋友,我被鼓励投票输入,我还没有使用该应用程序),然后,在记录在我的应用程序的索引页面上,这不是我以后的。



我正在使用PHP facebook SDK来获取一个loginUrl,这个:

  $ loginUrl = $ facebook-> getLoginUrl(array('canvas'=> 1,'fbconnect'= > 0,'scope'=>'email,publish_stream,offline_access,user_likes,publish_actions','next'=> $ canvasPage)); 

其中 $ canvasPage 是完整的我的服务器上的应用程序 $ loginURL 是我重定向用户的地方,如果我发现他没有登录我的应用程序。


解决方案

我应该更改哪些内容可以直接引导新用户直接在我的应用程序中的特定内容(子页面)解决了。我使用会话来存储用户最初需要获取的位置,然后将其重定向到登录页面,当他/她回来时,读取会话将用户重定向到最终目的地。


Short version

I have a facebook iframe app as a page tab on a fan page. The app collects entries for a contest. It lists the entries and also has a page for showing a single entry. I want to be able to link to the single-entry page - I have this working using the app_data parameter, but only if the user has used the app before. This does not work for a new user who has to add the app (log in).

Long version

So far I've managed to get this partially working by linking to

http://facebook.com/pages/<myPageName>/<myPageId>?sk=app_<myAppID>&app_data=<myUrlEncodedJsonData>

The app_data parameter is passed on to my application's iframe by facebook and I can then process it server-side to redirect the user to the appropriate subpage. All seems to work well... but only if I had logged into the application before trying to access the deep-linked content.

If I try to deep link to the single-entry page and don't have the application installed yet (scenario: I'm a friend of a contestant and I've been encouraged to vote for his entry, I haven't used the app yet), then, after logging in, I'm on the index page of my app, and that is not what I'm after.

I'm using PHP facebook SDK to obtain a loginUrl like this:

$loginUrl = $facebook->getLoginUrl(array('canvas' => 1,'fbconnect' => 0, 'scope' => 'email,publish_stream,offline_access,user_likes,publish_actions', 'next' => $canvasPage));

where $canvasPage is the full URL of the app on my server, $loginURL is where I redirect the user if I detect he is not logged in my application.

What should I change to be able to direct new users straight to specific content (subpage) within my app?

解决方案

Solved. I used session to store where the user wants to get initially, then redirect him to the login page, and when he/she's back, session is read to redirect the user to the final destination.

这篇关于Facebook应用程序 - 新的应用程序用户的深层链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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