Graph API 版本

憑證除錯 /debug_token

此端點會傳回有關指定存取憑證的中繼資料。其中包括發出憑證所適用的用戶、憑證是否仍然有效、憑證過期時間,以及應用程式為指定用戶提供的權限等資料。

有了這些資料,您可採用程式設計方式為大批存取憑證除錯。

讀取

Graph API 測試工具
GET /v19.0/debug_token?input_token={input-token} HTTP/1.1
Host: graph.facebook.com
/* PHP SDK v5.0.0 */
/* make the API call */
try {
  // Returns a `Facebook\FacebookResponse` object
  $response = $fb->get(
    '/debug_token?input_token={input-token}',
    '{access-token}'
  );
} catch(Facebook\Exceptions\FacebookResponseException $e) {
  echo 'Graph returned an error: ' . $e->getMessage();
  exit;
} catch(Facebook\Exceptions\FacebookSDKException $e) {
  echo 'Facebook SDK returned an error: ' . $e->getMessage();
  exit;
}
$graphNode = $response->getGraphNode();
/* handle the result */
/* make the API call */
FB.api(
    "/debug_token?input_token={input-token}",
    function (response) {
      if (response && !response.error) {
        /* handle the result */
      }
    }
);
/* make the API call */
new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "/debug_token?input_token={input-token}",
    null,
    HttpMethod.GET,
    new GraphRequest.Callback() {
        public void onCompleted(GraphResponse response) {
            /* handle the result */
        }
    }
).executeAsync();
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
                               initWithGraphPath:@"/debug_token?input_token={input-token}"
                                      parameters:params
                                      HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                      id result,
                                      NSError *error) {
    // Handle the result
}];

權限

參數

名稱 說明 類型

input_token

正在檢查的存取憑證。必須指定此參數。

string

欄位

名稱說明類型

data

圍繞結果的資料包裝函式。

object

app_id

此存取憑證適用的應用程式之編號。

string

application

此存取憑證適用的應用程式之名稱。

string

error

向 Graph API 提出要求時由於存取憑證而傳回的任何錯誤。

object

code

錯誤的錯誤代碼。

int

message

錯誤的錯誤訊息。

string

subcode

錯誤的錯誤子代碼。

int

expires_at

此存取憑證過期時間的時戳。

unixtime

data_access_expires_at

應用程式的用戶資料存取權限過期時間時戳。

unixtime

is_valid

存取憑證是否仍然有效。

bool

issued_at

此存取憑證發出時間的時戳。

unixtime

metadata

與存取憑證相關的一般中繼資料。可以包含「sso」、「auth_type」、「auth_nonce」等資料

object

profile_id

如果是模擬的存取憑證,則為此憑證包含的專頁之編號。

string

scopes

用戶在此存取憑證中向應用程式授予的權限之清單。

string[]

granular_scopes

用戶在此存取憑證中向應用程式授予的細項權限之清單。如果權限適用於全部事項,則不會顯示目標。

shape('scope' => string,'target_ids' => ?int[],)[]

user_id

此存取憑證適用的用戶之編號。

string

發佈與刪除

您無法於此關係連線執行這些操作。