Facebook 应用程序 - 新应用程序用户的深层链接
简短版本
我有一个 facebook iframe 应用程序作为粉丝页面上的页面选项卡。该应用程序收集竞赛参赛作品。它列出了条目,并且还有一个用于显示单个条目的页面。我希望能够链接到单条目页面 - 我使用 app_data
参数进行此操作,但前提是用户之前使用过该应用程序。这对于必须添加应用程序(登录)的新用户不起作用。
长版本
到目前为止,我已经成功通过链接到
http://facebook.com/pages/<myPageName>/<myPageId>?sk=app_<myAppID>&app_data=<myUrlEncodedJsonData>
app_data
参数通过 facebook 传递到我的应用程序的 iframe,然后我可以在服务器端处理它以将用户重定向到适当的子页面。一切似乎都运行良好......但前提是我在尝试访问深层链接内容之前已登录应用程序。
如果我尝试深层链接到单条目页面并且尚未安装该应用程序(场景:我是参赛者的朋友,并且有人鼓励我为他的条目投票,我还没有使用过应用程序尚未),然后,登录后,我位于应用程序的索引页面上,而这不是我想要的。
我正在使用 PHP facebook SDK 获取如下登录网址:
$loginUrl = $facebook->getLoginUrl(array('canvas' => 1,'fbconnect' => 0, 'scope' => 'email,publish_stream,offline_access,user_likes,publish_actions', 'next' => $canvasPage));
其中 $canvasPage
是我的服务器上应用程序的完整 URL,$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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
解决了。我使用会话来存储用户最初想要到达的位置,然后将他重定向到登录页面,当他/她回来时,读取会话以将用户重定向到最终目的地。
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.