0

ユーザー a - HTTP でアプリを実行するアプリの管理者

getUser() はユーザー ID を提供しています

ユーザー b - 管理者ではありません HTTP でアプリを実行する

getUser() はゼロを返し、URL は次のようになります &error_reason=user_denied&error=access_denied&error_description=The+user+denied+your+request.&state=32423dfs23423dsaaw# =

以下は、ユーザーを認証するためのコードユーザーです。

 $facebook = new Facebook(array(
      'appId'  => '',
      'secret' => '',
      'cookie' => true
    ));

 $user = $facebook->getUser();
    $loginUrl   = $facebook->getLoginUrl(
            array(
                 'scope' => 'publish_stream,email',
                 'redirect_uri' => 'https://www.facebook.com/pages/test?sk=app_23423423'

            )
    );


   if (!$user) {?>
  <a href="<?php echo $loginUrl ?>">Facebook Login</a>
            else
            {
                 echo "<script type='text/javascript'>location.href = 'test.php?Id=$user'</script>";  

            }
                   }
4

1 に答える 1

1

Whenever you get

error=access_denied

in the $_REQUEST back from the Facebook then you will no get User ID and this is because the user has logged in or authorized your app so that you might retrieve the User ID. This is same as the case when no user has logged in. You can get reason and description from the $_REQUEST['error_reason'] and $_REQUEST['error_description'] respectively to display further details to user or for your records.

于 2012-11-22T06:33:01.757 に答える