Javascript 如何从Trello API检索令牌
我正在构建一个应用程序,要求用户授权应用程序使用他的Trello帐户 首先,我使用我的开发者密钥(由Trello提供)并进行API调用,如下所示:Javascript 如何从Trello API检索令牌,javascript,node.js,rest,token,trello,Javascript,Node.js,Rest,Token,Trello,我正在构建一个应用程序,要求用户授权应用程序使用他的Trello帐户 首先,我使用我的开发者密钥(由Trello提供)并进行API调用,如下所示: Trello.authorize({ type: 'popup', name: 'My App', persist: 'true', // the token will be saved on localstorage scope: { read: 'true', write: 'tru
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
});
这将显示一个弹出窗口,要求用户允许(授权)
我的问题是,我如何在这个请求中获得令牌?此方法不提供任何响应
我发现获取令牌的唯一方法是:将用户发送到
https://trello.com/1/connect?key=my_developer_key&name=My+App&response_type=token&scope=read,write
但是,用户登录到一个空白页面,该页面显示:
“您已授予访问您的Trello信息的权限。”
要完成此过程,请提供此令牌:
“212656542121245…某种代币”
我不希望用户需要给我任何令牌
有人能帮我解决这个问题吗?谢谢在
身份验证成功
中,您将能够检查本地存储
:
localStorage.trello_token
希望能有所帮助。在Angular中,由于authOpts中的
persist=true(默认情况下),在成功身份验证后,我能够使用localStorage.getItem('trello_token')
从本地存储访问令牌