permission設定 | facebook api

oauthの連携は、出来ました。
普通のoauthのライブラリは使えませんが、簡単です。

AppIDとuriを設定するだけで(facebookのアプリケーション設定でdomain,redirect_uriを設定しました。)

1. 認証画面へ転送

https://www.facebook.com/dialog/oauth?

client_id=YOUR_APP_ID&redirect_uri=YOUR_URL&scope=email,read_stream

2. codeがかえってくる

http://YOUR_URL?code=A_CODE_GENERATED_BY_SERVER

3. codeを付けて access tokenを取得

https://graph.facebook.com/oauth/access_token?

client_id=YOUR_APP_ID&redirect_uri=YOUR_URL&
client_secret=YOUR_APP_SECRET&code=THE_CODE_FROM_ABOVE

これでOKです。あとは、idをよく使うので
4. idを取得

https://graph.facebook.com/me?access_token=ACCESS_TOKEN

これで、OKでした。

次に、feedにpostするには

http://developers.facebook.com/docs/authentication/permissions/

1のリクエスト時に、scopeに
publish_stream
を入れます。
裏での処理などをする場合は、offline_accessが必要になります。知らないと怪しいですが。。。

普通のoauthもありますが、古いので使わないほうが良さそうです。

http://developers.facebook.com/docs/authentication/connect_auth/

This entry was posted on 金曜日, 5月 27th, 2011 at 2:25 AM and is filed under Facebook. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.

Unityによるゲームを公開しております iOS/Android
https://itunes.apple.com/jp/app/lost-knight-3d-action/id900917032
https://play.google.com/store/apps/details?id=com.groundroad.runknight

各種開発支援・機能開発等小さいお仕事などもお請けしております。
unity開発支援, PHPシステム開発, javascript/html5 フロント開発, titanium mobileアプリ開発
お気軽にお問い合わせください
大崎・五反田近郊での対面でのお打ち合わせはいつでも可能です。