上报 Android 完整性令牌
curl --request POST \
--url https://api.qbank.cl/platform/v1/me/device-integrity \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"integrity_token": "integrity-token-from-play-api",
"integrity_nonce": "nonce-from-integrity-nonce-endpoint"
}
'import requests
url = "https://api.qbank.cl/platform/v1/me/device-integrity"
payload = {
"integrity_token": "integrity-token-from-play-api",
"integrity_nonce": "nonce-from-integrity-nonce-endpoint"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
integrity_token: 'integrity-token-from-play-api',
integrity_nonce: 'nonce-from-integrity-nonce-endpoint'
})
};
fetch('https://api.qbank.cl/platform/v1/me/device-integrity', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.qbank.cl/platform/v1/me/device-integrity",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'integrity_token' => 'integrity-token-from-play-api',
'integrity_nonce' => 'nonce-from-integrity-nonce-endpoint'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.qbank.cl/platform/v1/me/device-integrity"
payload := strings.NewReader("{\n \"integrity_token\": \"integrity-token-from-play-api\",\n \"integrity_nonce\": \"nonce-from-integrity-nonce-endpoint\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.qbank.cl/platform/v1/me/device-integrity")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"integrity_token\": \"integrity-token-from-play-api\",\n \"integrity_nonce\": \"nonce-from-integrity-nonce-endpoint\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.qbank.cl/platform/v1/me/device-integrity")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"integrity_token\": \"integrity-token-from-play-api\",\n \"integrity_nonce\": \"nonce-from-integrity-nonce-endpoint\"\n}"
response = http.request(request)
puts response.read_body{
"checked": true,
"verdict": "ok",
"device_ok": true,
"bound": true
}{
"error": "invalid_token",
"message": "integrity token must be 1-16384 chars without whitespace"
}{
"error": "rate_limited",
"message": "too many integrity reports, retry later"
}上报 Android 完整性令牌
上报 Android 应用的 Play Integrity 令牌以便服务端解码。verdict 将作为 device_integrity 安全事件审计。携带 integrity_nonce(由 POST /v1/auth/integrity-nonce 签发)时上报具有防重放绑定(bound=true);否则仍会审计,但永不通过 enforcement 门禁。verdict 取值:ok、device_basic、app_unknown、mismatch、error、unchecked、nonce_invalid。每成员每小时限 12 次。
POST
/
v1
/
me
/
device-integrity
上报 Android 完整性令牌
curl --request POST \
--url https://api.qbank.cl/platform/v1/me/device-integrity \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"integrity_token": "integrity-token-from-play-api",
"integrity_nonce": "nonce-from-integrity-nonce-endpoint"
}
'import requests
url = "https://api.qbank.cl/platform/v1/me/device-integrity"
payload = {
"integrity_token": "integrity-token-from-play-api",
"integrity_nonce": "nonce-from-integrity-nonce-endpoint"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
integrity_token: 'integrity-token-from-play-api',
integrity_nonce: 'nonce-from-integrity-nonce-endpoint'
})
};
fetch('https://api.qbank.cl/platform/v1/me/device-integrity', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.qbank.cl/platform/v1/me/device-integrity",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'integrity_token' => 'integrity-token-from-play-api',
'integrity_nonce' => 'nonce-from-integrity-nonce-endpoint'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.qbank.cl/platform/v1/me/device-integrity"
payload := strings.NewReader("{\n \"integrity_token\": \"integrity-token-from-play-api\",\n \"integrity_nonce\": \"nonce-from-integrity-nonce-endpoint\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.qbank.cl/platform/v1/me/device-integrity")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"integrity_token\": \"integrity-token-from-play-api\",\n \"integrity_nonce\": \"nonce-from-integrity-nonce-endpoint\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.qbank.cl/platform/v1/me/device-integrity")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"integrity_token\": \"integrity-token-from-play-api\",\n \"integrity_nonce\": \"nonce-from-integrity-nonce-endpoint\"\n}"
response = http.request(request)
puts response.read_body{
"checked": true,
"verdict": "ok",
"device_ok": true,
"bound": true
}{
"error": "invalid_token",
"message": "integrity token must be 1-16384 chars without whitespace"
}{
"error": "rate_limited",
"message": "too many integrity reports, retry later"
}