2016-09-01 67 views
0

我正在構建一個應用程序,要求用戶授權應用程序使用Trello帳戶。如何從Trello API檢索令牌

首先,我用我的開發者密鑰(由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 
}); 

這顯示了一個彈出詢問用戶允許(授權)。

我的問題是,我怎麼能得到這個請求中的令牌?此方法不提供任何響應。

我發現獲得令牌的唯一方法是:向用戶發送到......

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

然而,顯示空白頁面上的用戶的土地:

「你已經授予訪問權限到您的Trello信息。「 「要完成該過程,請給出以下標記:」 「21265656542121245 ... sometoken」

我不希望用戶需要給我任何令牌。

任何人都可以幫助我解決這個問題嗎?由於

回答

0

authenticationSuccess,你將能夠檢查localStorage

localStorage.trello_token 

希望它能幫助。