获取访问BOS临时STS凭证
接口描述
请求结构
POST /xasset/file/v1/getstoken HTTP/1.1
Host: xuper.baidu.com
Authorization: Authorization string
Content-Type: application/x-www-form-urlencoded;charset=utf-8
addr={address}
&sign={sign}
&pkey={pkey}
&nonce={nonce}
请求头域
请求参数
参数名称 |
类型 |
是否必选 |
描述 |
addr |
string |
必选 |
创建资产账户地址 |
sign |
string |
必选 |
创建资产账户私钥签名,内容为:msg = Sprintf(“%d”, nonce),sign = XassetSignECDSA(account, msg) |
pkey |
string |
必选 |
创建资产账户公钥 |
nonce |
int64 |
必选 |
随机数,可用sdk内置算法gen_nonce()生成 |
响应头域
响应参数
参数名称 |
类型 |
描述 |
errno |
int |
错误码 0为成功,其他可参考常用错误码 |
request_id |
int |
后端生成,用于问题反馈,建议业务日志纪录 |
accessInfo |
Array |
获取的临时授权的bos信息 |
+ bucket |
string |
存储空间 |
+ endpoint |
string |
访问域名 |
+ object_path |
string |
文件路径 |
+ access_key_id |
string |
访问密钥公钥 |
+ secret_access_key |
string |
访问密钥私钥 |
+ session_token |
string |
临时有权的token,有效期为30min |
+ createTime |
datatime |
鉴权生效开始时间 |
+ expiration |
datatime |
鉴权失效时间 |
请求示例
Post xasset/file/v1/getstoken
Host: xuper.baidu.com
Authorization: bce-auth-v1/f81d3b34e48048fbb2634dc7882d7e21/2022-04-18T04:17:29Z/3600/host/74c506f68c65e26c633bfa104c863fffac5190fdec1ec24b7c03eb5d67d2e1de
addr=bFKZMPVBtUPb1bdoXzWwKX1jaSy9omMjR
&pubKey={"Curvname":"P-256","X":99992390283545488142355111780630053962942114118238766864067722901319912547387,"Y":62636249704255210574823120529280656364753347818712821209439354501575504249596}
&sign=B014EDF86B6DEE29E167E9D9ED9C5832
&nonce=8856422235281354998
响应示例
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Date: Wed, 18 Apr 2022 03:28:11 GMT
X-Trace-Id: "1182282645"
{
"errno": 0,
"request_id": "1182282645",
"accessInfo": {
"bucket":"bj",
"endpoint":"https://bj.bcebos.com",
"object_path":"100100/",
"access_key_id": "3bdecf4afebd41849628389a20629ecc",
"secret_access_key": "3f901ef12d454b9c92ba2dde7c029140",
"session_token": "ZGZiM2M3MmU4Mjk4NGQ2M",
"createTime": "2015-11-18T11:48:17Z",
"expiration": "2015-11-18T23:48:17Z",
}
}