Ressources dev:Facebook

De Ressources pour développeurs - The Roxane Company.
(Différences entre les versions)
Aller à : Navigation, rechercher
(Ajouter une application dans une page fan)
 
(3 révisions intermédiaires par un utilisateur sont masquées)
Ligne 8 : Ligne 8 :
 
D'abord obtenir l'app access token :
 
D'abord obtenir l'app access token :
  
 +
<syntaxhighlight lang="php">
 
https://graph.facebook.com/oauth/access_token?
 
https://graph.facebook.com/oauth/access_token?
    client_id=YOUR_APP_ID
+
    client_id=YOUR_APP_ID&
  &client_secret=YOUR_APP_SECRET
+
    client_secret=YOUR_APP_SECRET&
  &grant_type=client_credentials
+
    grant_type=client_credentials
 +
</syntaxhighlight>
  
[http://developers.facebook.com/docs/authentication/applications/]
+
[http://developers.facebook.com/docs/authentication/applications/ http://developers.facebook.com/docs/authentication/applications/]
  
 
Ensuite créer le test user :
 
Ensuite créer le test user :
  
 +
<syntaxhighlight lang="php">
 
https://graph.facebook.com/APP_ID/accounts/test-users?
 
https://graph.facebook.com/APP_ID/accounts/test-users?
  installed=true
+
    installed=true&
  &name=FULL_NAME
+
    name=FULL_NAME&
  &locale=en_US
+
    locale=en_US&
  &permissions=read_stream
+
    permissions=read_stream&
  &method=post
+
    method=post&
  &access_token=APP_ACCESS_TOKEN
+
    access_token=APP_ACCESS_TOKEN
 +
</syntaxhighlight>
  
[https://developers.facebook.com/docs/test_users/]
+
[http://developers.facebook.com/docs/test_users/ http://developers.facebook.com/docs/test_users/]
 +
 
 +
== Obtenir l’access_token de l’application ==
 +
 
 +
$APPLICATION_ID = "APP_ID";
 +
 
 +
$APPLICATION_SECRET = "APP_SECRET";
 +
 
 +
$token_url = "https://graph.facebook.com/oauth/access_token?" .
 +
"client_id=" . $APPLICATION_ID .
 +
"&client_secret=" . $APPLICATION_SECRET .
 +
"&grant_type=client_credentials";
 +
 
 +
$app_token = file_get_contents($token_url);
 +
 
 +
Some of the features in Facebook Graph API requires a special kind of tokens called “app access token“. Features like Facebook Test Accounts and Facebook Insights make use of this token.

Version actuelle en date du 30 avril 2013 à 11:55

[modifier] Ajouter une application dans une page fan

https://www.facebook.com/dialog/pagetab?app_id=APP_ID&display=popup&next=URL_HTTPS_DU_CANEVAS

[modifier] Créer un Test User (maximum 500 test users par application)

D'abord obtenir l'app access token :

https://graph.facebook.com/oauth/access_token?
     client_id=YOUR_APP_ID&
     client_secret=YOUR_APP_SECRET&
     grant_type=client_credentials

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

Ensuite créer le test user :

https://graph.facebook.com/APP_ID/accounts/test-users?
     installed=true&
     name=FULL_NAME&
     locale=en_US&
     permissions=read_stream&
     method=post&
     access_token=APP_ACCESS_TOKEN

http://developers.facebook.com/docs/test_users/

[modifier] Obtenir l’access_token de l’application

$APPLICATION_ID = "APP_ID";

$APPLICATION_SECRET = "APP_SECRET";

$token_url = "https://graph.facebook.com/oauth/access_token?" . "client_id=" . $APPLICATION_ID . "&client_secret=" . $APPLICATION_SECRET . "&grant_type=client_credentials";

$app_token = file_get_contents($token_url);

Some of the features in Facebook Graph API requires a special kind of tokens called “app access token“. Features like Facebook Test Accounts and Facebook Insights make use of this token.

Outils personnels
Espaces de noms
Variantes
Actions
Navigation
Boîte à outils