Ad

App Asking About Itself With An App Token

Is there an app token equivalent to the "/me" alias? In other words, is there a way that an application can ask for data about itself without having to hardcode its application ID in the "/{app-id}" request? Essentially, all I want is the app ID itself and I could extract that from the app token, but the token is supposed to be opaque and String manipulation to do that extraction seems hokey. Before I do the hokey thing, was wondering if there's a better way for an application to ask about itself.

Ad

Answer

/app is a shortcut for 'current app' and will work with a user access token, page access token or app access token

Example:

https://graph.facebook.com/v2.0/app?access_token=<APP ACCESS TOKEN>

Response:

{
  "category": "Utilities", 
  "daily_active_users": "0", 
  "daily_active_users_rank": 1079202, 
  "icon_url": "https://fbstatic-a.akamaihd.net/rsrc.php/v2/yE/r/7Sq7wKJHi_5.png", 
  "link": "https://www.facebook.com/apps/application.php?id=[SNIPPED]", 
  "logo_url": "https://fbcdn-photos-c-a.akamaihd.net/hphotos-ak-xpa1/t39.2081-0/p75x75/[SNIPPED].png", 
  "mobile_web_url": "http://www[SNIPPED]", 
  "monthly_active_users": "1", 
  "monthly_active_users_rank": 1208403, 
  "name": "test app", 
  "subcategory": "Other", 
  "weekly_active_users": "1", 
  "id": "[SNIPPED]"
}
Ad
source: stackoverflow.com
Ad