Will Facebook SDK 3.1.x display authentication page?

I am doing a Canvas app inside the facebook page.

My very simple question is this: With the newest facebook SDK (just downloaded today), if a user has not yet granted access permission to your app, will the facebook class within the SDK automatically determine that and attempt to get authorization?

I can manually get auth for my app by going here:


That all works just fine... but when I attempt to do what the example.php does in the SDK, it returns an error:

Fatal error: Uncaught OAuthException: Invalid OAuth access token signature. thrown in /public_html/bridge/base_facebook.php on line 1107

Thus my question is: Am I supposed to be getting a valid OAuth access token, or am I setting up the facebook PHP SDK wrong?

Here is my complete PHP code that generates the error:

require 'facebook.php';

$facebook = new Facebook(array(
'app_id' => '<my app id>',
'app_secret' => '<my app secret>',

$user = $facebook->getUser();

$jared = $facebook->api('/jaredmark');

if ($user) {
try {
// Proceed knowing you have a logged in user who's authenticated.
$user_profile = $facebook->api('/me');
} catch (FacebookApiException $e) {
$user = null;

// Login or logout url will be needed depending on current user state.
if ($user) {
  $logoutUrl = $facebook->getLogoutUrl();
} else {
  $loginUrl = $facebook->getLoginUrl();

This code is essentially a direct copy/paste from the example, with a few minor edits.


It doesn't seem to be the case that the PHP SDK will display an authentication pop up without you manually causing it to do so by redirecting to that specific page. sigh

Need Your Help

Random data in Unit Tests?

unit-testing tdd mocking

I have a coworker who writes unit tests for objects which fill their fields with random data. His reason is that it gives a wider range of testing, since it will test a lot of different values, whe...

Extension Methods not working for an interface

c# .net extension-methods

Inspired by the MVC storefront the latest project I'm working on is using extension methods on IQueryable to filter results.