简体   繁体   中英

Facebook Javascript Canvas Login Redirect

I am building a facebook canvas application and want users, when they visit "apps.facebook.com/myApp", to be presented with the appropriate login dialogue immediately instead of showing my canvas page without having been logged in. With all the different login flows, I am confused!

Using javascript, how do I do this? Do I set the default canvas page to be a page with a script with a redirect url in it?

You should not immediately present them with the login dialog, it is best practice to show some intro screen with information about your app first. Else there is only a small authorization information and no use will really know what the app is about. Then let the user click on a "Login/Use/Start/..." button to present the authorization popup with the FB.login function of the JavaScript SDK:

https://developers.facebook.com/docs/reference/javascript/FB.login/

If you really want to require user authorization right at the beginning, user the PHP SDK:

https://github.com/facebook/facebook-php-sdk

See " $facebook->getLoginUrl() " - just redirect to the resulting URL if the user is not logged in.

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