圖形 API 版本

偵錯權杖 /debug_token

這個節點會傳回與指定存取權杖相關的中繼資料。其中包括該權杖的核發對象是哪一位用戶、該權杖是否仍然有效、權杖何時到期,以及應用程式同意指定用戶使用哪些權限。

偵錯權杖可用於使用多組存取權杖,透過程式設計方式進行問題偵錯。

讀取

圖形 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

對圖形 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

發佈與刪除

您無法在這個關係連線執行這些操作。