in templates/java/src/main/java/com/facebook/ads/sdk/APIContext.java [149:178]
public String getAppID() {
if (this.appID != null) {
return this.appID;
}
if (this.accessToken != null) {
try {
APIRequest.DefaultRequestExecutor executor = new APIRequest.DefaultRequestExecutor();
String apiUrl = this.endpointBase + "/" + this.version + "/debug_token";
Map<String, Object> params = new HashMap<String, Object>();
params.put("input_token", this.accessToken);
params.put("access_token", this.accessToken);
params.put("fields", "app_id");
APIRequest.ResponseWrapper response = executor.execute("GET", apiUrl, params, this);
JsonParser parser = new JsonParser();
this.appID = parser.parse(response.getBody())
.getAsJsonObject()
.get("data")
.getAsJsonObject()
.get("app_id")
.getAsString();
return this.appID;
} catch (Exception e) {
log("Unable to fetch appID from the access token");
}
}
return null;
}