【发布时间】:2018-07-07 21:48:58
【问题描述】:
当我添加此代码进行反应时,错误似乎是无法识别等待。确切的错误是“等待”字中预期的属性分配
我正在从此处阅读来自 aws-amplify 的有关自定义标头 https://aws.github.io/aws-amplify/media/api_guide#custom-request-headers 的文档。
这里是 index.js 中的代码(配置了放大)
aws_exports.API = {
endpoints:[
{
name: "my_custom_api",
endpoint: "http://localhost:57200/",
custom_header: async() => {
return { (await Auth.currentSession()).idToken.jwtToken }
}
}
]
}
Amplify.configure(aws_exports);
【问题讨论】:
-
我不能肯定地说,但对我来说,文档中似乎有错字。你试过
return { Authorization: (await Auth.currentSession()).idToken.jwtToken };吗? -
哦,对,没错。现在正在编译。谢谢
标签: javascript reactjs aws-amplify