我正在构建一个应用程序,要求用户授权该应用程序使用他的 Trello 帐户。
首先,我使用我的开发人员 key (由 Trello 提供)并执行 API 调用,如下所示:
Trello.authorize({
type: 'popup',
name: 'My App',
persist: 'true', // the token will be saved on localstorage
scope: {
read: 'true',
write: 'true'
},
expiration: 'never',
success: authenticationSuccess,
error: authenticationFailure
});
这会显示一个弹出窗口,要求用户允许(授权)。
我的问题是,如何在这个请求中获取 token ?此方法不提供任何响应。
我发现获取 token 的唯一方法是:将用户发送到...
https://trello.com/1/connect?key=my_developer_key&name=My+App&response_type=token&scope=read,write
但是,用户登陆显示的空白页面:
“您已授权访问您的 Trello 信息。” “要完成这个过程,请给这个 token :” “21265656542121245...一些 token ”
我不希望用户需要给我任何 token 。
谁能帮我解决这个问题?谢谢
最佳答案
在 authenticationSuccess
中,您将能够检查 localStorage
:
localStorage.trello_token
希望对您有所帮助。
关于javascript - 如何从 Trello API 检索 token ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39280238/