图谱 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

发布和删除

无法在此连线上执行这些操作。