登录用户变量上传
获取认证码
javapublic String authToken(String projectKeyId, String secretKey, String keyArray) throws Exception {
String message = "ai="+projectKeyId+"&loginUserId="+keyArray;
Mac hmac = Mac.getInstance("HmacSHA256");
hmac.init(new SecretKeySpec(secretKey.getBytes("UTF-8"), "HmacSHA256"));
byte[] signature = hmac.doFinal(message.getBytes("UTF-8"));
return Hex.encodeHexString(signature);
}
def authToken(projectKeyId: String, secretKey: String, keyArray: String): String = {
val message = s"ai=$projectKeyId&loginUserId=$keyArray"
val hmac: Mac = Mac.getInstance("HmacSHA256")
hmac.init(new SecretKeySpec(secretKey.getBytes("UTF-8"), "HmacSHA256"))
val signature = hmac.doFinal(message.getBytes("UTF-8"))
Hex.encodeHexString(signature)
}#coding:utf-8
import hashlib
import hmac
def authToken(projectKeyId,secretKey,keyArray):
message = ("ai=" + projectKeyId + "&loginUserId=" + keyArray).encode('utf-8')
signature = hmac.new(bytes(secretKey.encode('utf-8')), bytes(message), digestmod=hashlib.sha256).hexdigest()
return signature接口定义
URL
请求类型
Last updated
Was this helpful?