简体   繁体   中英

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

I've developed a Facebook app (with iframe) using CakePHP. I get some Facebook user info when the app opens and display a form to send SMS free.

So, the user must be authenticated in Facebook before continuing in the app.

I'm using the Facebook SDK php (Copyright 2004-2008 Facebook. All Rights Reserved.)

How could I avoid Facebook to redirect to my own site when the user has lost the auth session?

Are you having the user use the FB login popups, and the FB authorization code?

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.

    $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?

If you are using facebook for login credentials, then you are required to redirect to your own site. This is a facebook security rule and you can imagine why it exists.

For anything fancy, you'll want to use the facebook "server-side" flow. It's fairly straight forward:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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