Jump to content

Facebook SDK questions - authentication and app flow


Recommended Posts

I'm building my first ever page tab app for a facebook fan page. It's mostly static HTML with a gallery of user submitted images. The users will be able to vote for the images and the picture with the most votes wins. SImple enough, but I'm struggling here.


I'm currently facing 2 problems - the first one is related to authentication inside the app and the other to app flow.


1. authentication


In order to know who uploaded the picture, I need to get some unique user info + name. I found out that this is impossible without user authentication, so I'm trying to get the user to authenticate and let me use their ID/name.


I created a login link using the getLoginUrl method of the php SDK. This login link works fine when used outside the context of facebook, but doesn't do anything when clicked inside the page tab.


How else do I get the desired user data ?


2. app flow


I'm trying to split the app into 3 main modules for now - main page, pre-like and upload form. Which one is displayed would be determined by a post variable.

My index page looks like this:



include( 'head.php' ); 

if ( $is_liked )
switch( $_GET['c'] ) 
case 'upload' :
include( 'pages/upload-form.php' );
default : 
include( 'pages/main.php' );
} else 
include( 'pages/pre-like.php' );

include( 'foot.php' ); 

The head file initializes the FB Object and creates a variable to say if the user like the page or not.



$signed_requrest = $fb->getSignedRequest();
$is_liked = $signed_requrest['page']['liked'];


This works fine, but when I'm on some other page (with a URL parameter), then the FB object will not be created correctly, therefore I'm not able to get the 'liked' state of the current user. Does anyone have any idea what's wrong with this ?


I hope someone will be able to help me, as the documentation is not too clear about these things...

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.