Facebookアプリ入門-User and friends PermissionsとExtended Permissions-

この記事は公開されてから1年以上経過しています。情報が古い可能性がありますので、ご注意ください。

User and friends PermissionsとExtended Permissions

ユーザがあるアプリを利用する際、基本情報以上の情報を求めることがあります。ユーザと友達に関する情報への許可と拡張許可です。この機能は結構キモいw。

前回のおさらいとして、基本情報とは何か再確認します。基本情報は、「名前、プロフィール写真、性別、ネットワーク、ユーザーID、友達リストなどの情報が含まれます。」と説明にありました。

User and friends Permissions

「ユーザと友達に関する情報への許可」は、さらに多くの情報をアプリに提供することになります。

  • あなたの説明と友達の説明 (user_about_me、friends_about_me)
  • あなたのアクティビティと友達のアクティビティ (user_activities、friends_activities)
  • あなたの生年月日と友達の生年月日 (user_birthday、friends_birthday)
  • あなたのチェックインと友達のチェックイン (user_checkins、friends_checkins)
  • あなたの学歴と友達の学歴 (user_education_history、friends_education_history)
  • あなたのイベントと友達のイベント (user_events、friends_events)
  • あなたのグループと友達のグループ (user_groups、friends_groups)
  • あなたの出身と友達の出身 (user_hometown、friends_hometown)
  • あなたの趣味・関心と友達の趣味・関心 (user_interests、friends_interests)
  • あなたの好きなものと友達の好きなもの (user_likes、friends_likes)
  • あなたの位置情報と友達の位置情報 (user_location、friends_location)
  • あなたのノートと友達のノート (user_notes、friends_notes)
  • あなたのオンライン状態と友達のオンライン状態 (user_online_presence、friends_online_presence)
  • あなたの写真・動画タグと友達の写真・動画タグ (user_photo_video_tags、friends_photo_video_tags)
  • あなたの写真と友達の写真 (user_photos、friends_photos)
  • あなたのクエスチョンと友達のクエスチョン (user_questions、friends_questions)
  • あなたの交際ステータスと友達の交際ステータス (user_relationships、friends_relationships)
  • あなたの交際関係の詳細と友達の交際関係の詳細 (user_relationship_details、friends_relationship_details)
  • あなたの政治観と宗教・信仰と友達の政治観と宗教・信仰 (user_religion_politics、friends_religion_politics)
  • あなたの近況アップデートと友達の近況アップデート (user_status、friends_status)
  • あなたの動画と友達の動画 (user_videos、friends_videos)
  • あなたのウェブサイトと友達のウェブサイト (user_website、friends_website)
  • あなたの職歴と友達の職歴 (user_work_history、friends_work_history)
  • あなたのEメールアドレス (email)
  • あなたのゲームとアプリのアクティビティと友達のゲームとアプリのアクティビティ (user_games_activity、friends_games_activity)
  • あなたの購読している人、購読されている人と友達の購読している人、購読されている人 (user_subscriptions、friends_subscriptions)
  • あなたの ()

これら全ての許可を得るソースで表すと以下のようになります。

 <html>
    <head>
      <title>My Facebook Login Page</title>
    </head>
    <body>
      <div id="fb-root"></div>
      <script>
        window.fbAsyncInit = function() {
          FB.init({
            appId      : '281845481847126',
            status     : true, 
            cookie     : true,
            xfbml      : true
          });
        };
        (function(d){
           var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
           js = d.createElement('script'); js.id = id; js.async = true;
           js.src = "//connect.facebook.net/ja_JP/all.js";
           d.getElementsByTagName('head')[0].appendChild(js);
         }(document));
      </script>
      <div class="fb-login-button" 
        data-perms="user_about_me,friends_about_me,user_activities,friends_activities,
        user_birthday,friends_birthday,user_checkins,friends_checkins,
        user_education_history,friends_education_history,
        user_events,friends_events,user_groups,friends_groups,
        user_hometown,friends_hometown,user_interests,friends_interests,
        user_likes,friends_likes,user_location,friends_location,
        user_notes,friends_notes,user_online_presence,friends_online_presence,
        user_photo_video_tags,friends_photo_video_tags,user_photos,friends_photos,
        user_questions,friends_questions,user_relationships,friends_relationships,
        user_relationship_details,friends_relationship_details,
        user_religion_politics,friends_religion_politics,user_status,friends_status,
        user_videos,friends_videos,user_website,friends_website,
        user_work_history,friends_work_history,email">
        Login with Facebook
      </div>
    </body>
 </html>

実行結果の画面です。

アプリを使いたければ個人情報を差し出しなさいと。。。

Extended Permissions

「拡張許可」は、さらに情報をユーザに求めます。

  • カスタマイズした友達リストへのアクセス (read_friendlists)
  • インサイト (read_insights)
  • メッセージへのアクセス (read_mailbox)
  • ニュースフィードへのアクセス (read_stream)
  • 友達リクエストへのアクセス (read_requests)
  • Facebookチャットへのアクセス (xmpp_login)
  • イベントの管理 (ads_management)
  • 広告の管理 (create_event)
  • 自分の名前を使ったFacebookへの投稿 (manage_friendlists)
  • 常時情報アクセス (offline_access)
  • テキスト送信 (sms)
  • お知らせの管理 (manage_notifications)
  • チェックイン (publish_checkins)
  • 自分の名前を使ったFacebookへの投稿 (publish_stream)
  • イベントの管理 (rsvp_event)
  • ゲームのスコアをFacebookでシェアする (publish_actions)
  • ニュースフィードへのアクセス (export_stream)

他にもFacebookページの管理許可もあります。

  • Facebookページの管理 (manage_pages)

これら全ての許可を確認するソースは以下のようになります。

 <html>
    <head>
      <title>My Facebook Login Page</title>
    </head>
    <body>
      <div id="fb-root"></div>
      <script>
        window.fbAsyncInit = function() {
          FB.init({
            appId      : '281845481847126',
            status     : true, 
            cookie     : true,
            xfbml      : true
          });
        };
        (function(d){
           var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
           js = d.createElement('script'); js.id = id; js.async = true;
           js.src = "//connect.facebook.net/ja_JP/all.js";
           d.getElementsByTagName('head')[0].appendChild(js);
         }(document));
      </script>
      <div class="fb-login-button" data-perms="read_friendlists,
	read_insights,read_mailbox,read_stream,read_requests,
	xmpp_login,ads_management,create_event,manage_friendlists,
	offline_access,sms,manage_notifications,
	publish_checkins,publish_stream,rsvp_event,
	publish_actions,manage_pages">
        Login with Facebook
      </div>
    </body>
 </html>

ちなみに、publish_actionsの許可確認は、ゲームスコアに関する設定が必要です。アプリの詳細設定画面を開きます。

ゲームスコアに関して「有効」しましょう。

publish_actionsが入った許可画面を実行すると、まず始めにスコアの共有について確認が入ります。

次に拡張許可の確認画面です。

ユーザのアプリ設定画面はどんな状態か確認する

怖いもの見たさでアプリ設定画面を確認しましょう。

こんなFacebookアプリは嫌だぁぁぁぁぁぁwww

まとめ

Facebookアプリは、Andoirdアプリと同じように様々な情報へのアクセス許可を求めてきます。多くのアプリを使っているとインストール時に感覚が麻痺してしまい、よく読まずに許可ボタン押したりしていませんでしょうか?どのアプリアプリも大変魅力的ですが、そのアプリを提供している会社や個人やサービスについて信頼できるときのみ許可するように心がけましょう。間違って許可してしまっても後で取り消す事もできますし、一部のみ拒否することもできますので、公開範囲を意識して利用しましょう。今日から君もFacebookアプリのデベロッパーだ!!

参考情報

Permissions