简体   繁体   English

Facebook应用程序的URL画布重定向到我自己的URL:使用CakePHP开发

[英]The URL canvas of a Facebook app redirects to my own: developed in CakePHP

I've developed a Facebook app (with iframe) using CakePHP. 我已经使用CakePHP开发了一个Facebook应用程序(使用iframe)。 I get some Facebook user info when the app opens and display a form to send SMS free. 当应用打开并显示免费发送SMS的表格时,我会收到一些Facebook用户信息。

So, the user must be authenticated in Facebook before continuing in the app. 因此,在继续应用前,必须先在Facebook中对用户进行身份验证。

I'm using the Facebook SDK php (Copyright 2004-2008 Facebook. All Rights Reserved.) 我正在使用Facebook SDK php(版权所有2004-2008 Facebook。保留所有权利。)

How could I avoid Facebook to redirect to my own site when the user has lost the auth session? 用户丢失身份验证会话后,如何避免Facebook重定向到我自己的网站?

Are you having the user use the FB login popups, and the FB authorization code? 您是否让用户使用FB登录弹出窗口和FB授权代码?

Not sure if this will work for your situation, but on the loginURL code, you can pass in a redirect_uri that could point to a page that you want them forwarded to after they complete the login and the authentication procedure. 不确定这是否适合您的情况,但是在loginURL代码上,您可以传递redirect_uri,它可以指向您希望他们在完成登录和身份验证过程之后转发到的页面。

    $url = $facebook->getLoginUrl(array('scope'=>'offline_access,publish_stream,email',
                    'redirect_uri'=>'https://www.mysite.com/mysite/'));

Hope that's what you were looking for. 希望这就是您想要的。

I understand everything in the question except the last line. 除了最后一行,我了解问题中的所有内容。 What do you mean by: 你是什​​么意思:

How could I avoid Facebook to redirect to my own site when the user has lost the auth session? 用户丢失身份验证会话后,如何避免Facebook重定向到我自己的网站?

If you are using facebook for login credentials, then you are required to redirect to your own site. 如果您使用facebook作为登录凭证,则需要重定向到您自己的站点。 This is a facebook security rule and you can imagine why it exists. 这是一个Facebook安全规则,您可以想象为什么它存在。

For anything fancy, you'll want to use the facebook "server-side" flow. 出于任何幻想,您将需要使用Facebook“服务器端”流程。 It's fairly straight forward: 这很简单:

http://developers.facebook.com/docs/authentication/ http://developers.facebook.com/docs/authentication/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM