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:

https://graph.facebook.com/oauth/authorize?client_id=<myClientID>&redirect_uri=<myRedirectURL>&type=user_agent&display=page&scope=publish_stream,%20user_about_me,%20user_likes,%20email

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:

<?php
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) {
error_log($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.

Answers


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

Unlimited Unsigned Integer linked-list implementation. Subtraction not working

c++ algorithm data-structures unsigned-integer

So, I have implemented an entire Unlimited Unsigned integer class using a linked-list for a project Euler problem I am working on. I have verified that all of the logical bit operations are correct

Import for mockito

java mockito

I am trying to put statement like

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.