第三方接入
请求流程
签名生成示例(伪代码)
# 1. 准备参数(不包含 sign)
params = {
"account": "[email protected]",
"expirationData": "2024-10-25 10:09:55",
"source": "CatWallet",
"timestamp": 1698203395
}
# 2. 按字典序排序
sorted_params = dict(sorted(params.items()))
# 3. 转换为 JSON 字符串
json_str = json.dumps(sorted_params)
# 4. 使用私钥加密并 Base64 编码
encrypted = rsa_encrypt(json_str, private_key)
sign = base64_encode(encrypted)
# 5. 添加到请求参数
params["sign"] = signAuthorizations
AuthorizationstringRequired
使用从 /thirdPartyLogin 接口获取的 userToken 进行身份验证。
在请求头中添加:
Authorization: Bearer {userToken}
示例:
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoxMjM0LCJ1c2VyX2tleSI6InVzZXJAZXhhbXBsZS5jb20iLCJleHAiOjE2OTgyMDMzOTV9.xxxxx
注意:
/thirdPartyLogin接口不需要 Authorization header(用于获取 token)- 其他所有接口都需要在请求头中携带 Authorization header
- Token 过期后需要重新调用
/thirdPartyLogin获取新 Token
Body
Responses
200
登录成功
application/json
400
请求参数错误
application/json
500
服务器内部错误
application/json
post
/thirdPartyLoginAuthorizations
AuthorizationstringRequired
使用从 /thirdPartyLogin 接口获取的 userToken 进行身份验证。
在请求头中添加:
Authorization: Bearer {userToken}
示例:
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoxMjM0LCJ1c2VyX2tleSI6InVzZXJAZXhhbXBsZS5jb20iLCJleHAiOjE2OTgyMDMzOTV9.xxxxx
注意:
/thirdPartyLogin接口不需要 Authorization header(用于获取 token)- 其他所有接口都需要在请求头中携带 Authorization header
- Token 过期后需要重新调用
/thirdPartyLogin获取新 Token
Responses
200
Token 有效,登录态可用
application/json
401
Token 失效,需要重新登录
application/json
500
服务器内部错误
application/json
get
/checkLoginLast updated