0
私は認証サイクルで何か間違っていると確信していますが、私は500sを取得し続け、メッセージはかなり曖昧です。ボックスノードAPIフォルダ情報を取得できますが、フォルダを作成できません
私はノードサーバーからボックスを呼び出しています。最初に私は、クライアントを作成します。
const sdk = new BoxSDK({
clientID: process.env.CLIENT_ID,
clientSecret: process.env.CLIENT_SECRET,
appAuth: {
keyID: process.env.PUBLIC_KEY_ID,
privateKey: fs.readFileSync(path.resolve(__dirname, process.env.PRIVATE_KEY_PATH)),
passphrase: process.env.PRIVATE_KEY_PASSPHRASE,
},
});
app.use((req, res, next) => {
req.sdk = sdk.getAppAuthClient('user', process.env.BOX_USER_ID);
next();
});
私は要求をトリガするクライアント作成したら:
export function yearEnd(req, res) {
req.sdk.folders.create({
name: 'test',
parent: {
id: '0',
},
}, (e, r) => {
if (e) {
return res.send(e);
}
return res.status(201).send(r);
});
}
を私は取り戻す応答は次のとおりです。
{
"request": {
"uri": {
"protocol": "https:",
"slashes": true,
"auth": null,
"host": "api.box.com",
"port": 443,
"hostname": "api.box.com",
"hash": null,
"search": null,
"query": null,
"pathname": "/2.0/folders",
"path": "/2.0/folders",
"href": "https://api.box.com/2.0/folders"
},
"method": "POST",
"headers": {
"User-Agent": "Box Node.js SDK v1.0.0",
"Authorization": "[REMOVED BY SDK]",
"accept": "application/json",
"content-type": "application/json",
"content-length": 75
}
},
"response": {
"statusCode": 500,
"body": {
"type": "error",
"status": 500,
"code": "internal_server_error",
"help_url": "http://developers.box.com/docs/#errors",
"message": "Internal Server Error",
"request_id": "29462704457e0f3876ee08"
},
"headers": {
"server": "ATS",
"date": "Tue, 20 Sep 2016 08:29:59 GMT",
"content-type": "application/json",
"content-length": "188",
"cache-control": "no-cache, no-store",
"strict-transport-security": "max-age=31536000; includeSubDomains",
"vary": "Accept-Encoding",
"age": "0",
"connection": "keep-alive"
},
"request": {
"uri": {
"protocol": "https:",
"slashes": true,
"auth": null,
"host": "api.box.com",
"port": 443,
"hostname": "api.box.com",
"hash": null,
"search": null,
"query": null,
"pathname": "/2.0/folders",
"path": "/2.0/folders",
"href": "https://api.box.com/2.0/folders"
},
"method": "POST",
"headers": {
"User-Agent": "Box Node.js SDK v1.0.0",
"Authorization": "[REMOVED BY SDK]",
"accept": "application/json",
"content-type": "application/json",
"content-length": 75
}
}
},
"statusCode": 500,
"maxRetriesExceeded": true
}
誰も教えてもらえます私は何をやっているの?