Qbit API 认证
使用Qbit API时,使用Access Token对客户端请求进行身份验证。
Access Token是唯一的数据字符串,用于对用户进行身份验证,并允许访问Qbit API上的操作。所有Qbit API都使用Access Token作为认证客户端请求的机制。您的访问令牌应始终保密和安全。
- 所有API请求都需要身份验证; 没有它,请求将失败。
- 所有API请求必须通过HTTPS进行。
API 认证
x-qbit-access-token: YOUR_ACCESS_TOKEN
测试认证
1. 获取code
# Replace ${QBIT_CLIENT_ID} with your client id
curl -H 'Accept: application/json' \
-X GET --url https://api-sandbox.qbitnetwork.com/open-api/oauth/authorize?clientId=${QBIT_CLIENT_ID}
Successful Response
{
"timestamp": 1678775522,
"code": "a38810c9e0bdac584f86953721b9a965"
}
2. 请求Access Token
# Replace ${QBIT_CLIENT_ID} with your client id
# Replace ${QBIT_CLIENT_SECRET} with your client secret
# Replace ${QBIT_AUTH_CODE} with your code
curl -H 'Accept: application/json' \
-X POST --url https://api-sandbox.qbitnetwork.com/open-api/oauth/access-token \
--data "{
\"clientId\": ${QBIT_CLIENT_ID},
\"clientSecret\": ${QBIT_CLIENT_SECRET},
\"code\": ${QBIT_AUTH_CODE}
}"
Successful Response
{
"accessToken": "be41c06e11795655e439cbd4b02c335e770ba27f",
"refreshToken": "b93a7ac26e7b70ef322fab08f234d8b7d0bda50c32dc5d6d972716e66788ad61",
"expiresIn": 86400,
"timestamp": 1678775835
}
Updated 4 months ago