Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 630099
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T19:49:08+00:00 2026-05-13T19:49:08+00:00

I have a Facebook app that is built as an iFrame. I am using

  • 0

I have a Facebook app that is built as an iFrame. I am using the JavaScript client API loaded via:

  • http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php

In my initialization code, I use the requireLogin method to ensure that the user has authorized the app. I have found this to be necessary to be able to gather the user’s name, avatar, etc. for the scoreboard. Here’s a representative code snippet:

FB_RequireFeatures(["Connect","Api"], function() {

    FB.Facebook.init("...API_KEY_HERE...", "xd_receiver.htm");

    var api = FB.Facebook.apiClient;
    api.requireLogin(function() {
        api.users_getInfo(
            FB.Connect.get_loggedInUser(),
            ["name", "pic_square", "profile_url"],
            function(users, ex) {
                /* use the data here */
            });
    });
});

This causes the iframe to redirect causing the Facebook authorization screen to load within my app’s iFrame. This looks junky and is somewhat confusing to the user, e.g. there are two Facebook bars, etc.

Question 1: is there anything I can do to clean this up while still implementing as an iFrame, and still using the JavaScript APIs?

According to the FB API documentation:

FB.ApiClient.requireLogin

This method is deprecated – use
FB.Connect.requireSession instead.

My experience though when I replace api.requireLogin with FB.Connect.requireSession it never gets invoked. I’d prefer the recommended way of doing it but I struggled and was not able to find a way to get it to work. I tried adding various arguments for the other two parameters as well with seemingly no effect. My expectation is that this method will load in a dialog box inside my app iFrame with a similar authorization message.

Question 2: what am I missing with getting FB.Connect.requireSession to properly prompt the user for authorization?

Finally, at the end of the game, the app prompts the user for the ability to publish their score to their stream via FB.Connect.streamPublish. Which leads me to…

Question 3: am I loading the correct features? Do I need both “Api” and “Connect”? Am I missing any others?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T19:49:08+00:00Added an answer on May 13, 2026 at 7:49 pm

    I think that FB.requireSession only works from a FB connect site outside of
    Facebook. If you’re using an app hosted on apps.facebook.com use the php api
    call instead,

    $facebook = new Facebook($appapikey, $appsecret);
    $facebook->require_login();

    or link to the login page.

    Of these methods to login

    *  Using the PHP client library
    * Directing users to login.php
    * Including the requirelogin attribute in a link or form
    * Using FBML 
    

    only the first 2 are available to iframe apps hosted on apps.facebook.com

    I think requirelogin and fbml only work with fbml canvas apps.

    see
    http://wiki.developers.facebook.com/index.php/Authorization_and_Authentication_for_Canvas_Page_Applications_on_Facebook

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.