0

所以我有一个小问题,当用户第一次使用我的应用程序时,它被重定向到:

http://www.facebook.com/MY_APP.../?state=f5c913239670dc934fae1274a81fa538&code=AQAmY5k8gRRt7woNKmpc_6z2eHgT-2B3prjNEDYFma1KqpQDKob-CS_bWfqd0qPkQD-tGoVdKUK8twGZRnLhoiotpZ3SlBeo3uusfmMyWDYStv-D79RvQEP8m9M8S8GYlbN3x1eLEd4D3RajWokTNAhRP8a1VB9VSKAb35xXFzg3PkheRKHqjr-nex5jcjM7Nv2B_JEV1w8AzM2LJg2M9kAb#_=_

我得到错误:page not found

在许可批准期间,我的链接是:https://www.facebook.com/dialog/oauth?client_id=456080124457246&redirect_uri=http%3A%2F%2Fpadekime.wu.lt%2Fplaukai%2Findex.php&state=2c46a86dae43af0467da756bc3e52779&scope=publish_stream%2Cphoto_upload

我添加了重定向链接,现在它转到:

http://www.padekime.wu.lt/plaukai/kontekstas/?state=5abfd521df3c68ae55f26ad51a704743&code=AQDMmpZC-_Yxatq4xuAE60Tl2qW4pXCvDeghrbMGGu3Lg1X8zqrk-lvxRc3VOoYvgoLvATJhcsyykZnPoM7XI2sXih-nJhKrjx-HS3GFapELmC4KvX4KyN-VU-znHopkA-q_zcuIffJ0tY79CXPn7mo05BpxfvPntXaUAe7ymLf1p8Kg29eERaP5nw1dChbwwZ13FNY7BXD2ymAsFHPNH5zw#_=_

http://www.facebook.com/Padekime/app_456080124457246在没有/?state=.....的情况下,可以在获得许可后正常进入我的应用程序吗?

我的代码现在看起来像:

<?php 
require_once('images/Facebook.php');

  $facebook = new Facebook(array(
    'appId'  => '456080124457246',
    'secret' => 'e2956a6e1de8791363faedb1ef44c408',
  ));

  # Get User ID
  $user = $facebook->getUser();

  if ($user) {
    try {
$redirectUri = 'http://www.padekime.wu.lt/plaukai/kontekstas/';
  # Photo Caption
  $photoCaption = 'Patarimų plaukams sužinojau čia http://goo.gl/otwhf';

  # Absolute Path to your image.
  $imageUrl = 'http://padekime.wu.lt/plaukai/images/PlaukaiNeuzvedus.jpg'; // Example URL

  # Post Data for Photos API
  $post_data = array(
      'message' => $photoCaption,
      'url' => $imageUrl,
      'redirect_uri' => $redirectUri

  );

      $apiResponse = $facebook->api('/me/photos', 'POST', $post_data);

    } catch (FacebookApiException $e) {
      $user = null;
      error_log($e);
    }
  } else {
$redirectUri = 'http://www.padekime.wu.lt/plaukai/kontekstas/';
    $loginUrl = $facebook->getLoginUrl( array(
        'scope' => 'publish_stream,photo_upload',
        'redirect_uri' => $redirectUri
    ));
    echo("<script>top.location.href = '" . $loginUrl . "';</script>");
  }
?>

据我了解,问题出在此处,但我无法解决。

$loginUrl = $facebook->getLoginUrl( array(
    'scope' => 'publish_stream,photo_upload'    
));
echo("<script>top.location.href = '" . $loginUrl . "';</script>");

因此,如果您对此有所了解,请帮助我,非常感谢。

解决方案:

我将 ?ref=ts 添加到 $redirectUri:

$redirectUri = 'http://www.facebook.com/Padekime/app_456080124457246?ref=ts';

4

1 回答 1

0

解决方案:

我将 ?ref=ts 添加到 $redirectUri:

$redirectUri = ' http://www.facebook.com/Padekime/app_456080124457246?ref=ts ';

于 2013-02-08T16:34:56.827 回答