如何解决Slack API:如何使用 oAuth 进行身份验证?
我正在关注Slack's docs on authenticating with oAuth.
范围和令牌设置得很好。我正在努力设置 installationStore.
installationStore: {
fetchInstallation: async InstallQuery => {
// change the line below so it fetches from your database
// return await database.get(InstallQuery.teamId);
let cityRef = db.collection("teams").doc(InstallQuery.teamId);
let getDoc = cityRef
.get()
.then(doc => {
if (!doc.exists) {
console.log("No such document!");
} else {
console.log("Document data:",doc.data());
}
})
.catch(err => {
console.log("Error getting document",err);
});
return await getDoc;
}
}
我不确定我应该 return-await 是 getDoc,还是不是。有什么线索吗?
解决方法
尝试这样的事情:
installationStore: {
fetchInstallation: async (InstallQuery) => {
return await getData();
};
}
async function getData() {
try {
let cityRef = db.collection("teams").doc(InstallQuery.teamId);
let doc = await cityRef.get();
return doc.data();
} catch(ex){
throw new Error("Failed fetching installation");
}
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。