如何从Trello API中检索令牌

时间:2022-08-27 20:26:19

I'm building an application that asks the user to authorize the application to use him Trello account.

我正在构建一个应用程序,要求用户授权应用程序使用他的Trello帐户。

First, I use my developer key (provided by Trello) and do a API call, like that:

首先,我使用我的开发人员密钥(由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
});

This shows a pop up asking to user to allow (authorize).

这显示弹出窗口要求用户允许(授权)。

My question is, how can I get the token in this request? This method doesn't deliver any response.

我的问题是,如何在此请求中获取令牌?此方法不会提供任何响应。

The only way I found to get the token is: send the user to...

我找到获取令牌的唯一方法是:将用户发送给...

https://trello.com/1/connect?key=my_developer_key&name=My+App&response_type=token&scope=read,write

However, the user lands on a blank page that shows:

但是,用户登录的空白页面显示:

"You have granted access to your Trello information." "To complete the process, please give this token:" "21265656542121245...sometoken"

“您已授予访问Trello信息的权限。” “要完成此过程,请提供此令牌:”“21265656542121245 ... sometoken”

I don't want the user needs to give me any token.

我不希望用户需要给我任何令牌。

Can any one help me with this issue? Thanks

任何人都可以帮我解决这个问题吗?谢谢

1 个解决方案

#1


1  

In authenticationSuccess you will be able to check the localStorage:

在authenticationSuccess中,您将能够检查localStorage:

localStorage.trello_token

Hope it help.

希望它有所帮助。

#1


1  

In authenticationSuccess you will be able to check the localStorage:

在authenticationSuccess中,您将能够检查localStorage:

localStorage.trello_token

Hope it help.

希望它有所帮助。