30
A
回答
49
可以在2的一個方式做到這一點 -
將用戶引導到下面的地址。這將引導用戶訪問具有可以複製並粘貼回給您的令牌的頁面。最重要的一點是,你要求expiration = never
和scope = read,write
https://trello.com/1/authorize?key=substitutewithyourapplicationkey&scope=read%2Cwrite&name=My+Application&expiration=never&response_type=token
或者使用OAuth(難)自動訪問令牌的請求。詳情請參閱documentation。
一旦你有了令牌,你可以進行任何你想要的API調用。
10
如果你必須做一切服務器端,安迪瓊斯是正確的,那些是唯一的兩種方式。
但是,應該注意的是,如果您可以編寫javascript + jquery代碼而不必執行重定向服務器端,則可以利用Trello的client.js包裝器,它完全符合Andy所描述的內容,但照顧它的大部分給你,這是方便的方式。
而且,正如我最近發現的,如果您確實需要處理服務器端,您仍然可以使用client.js,然後在auth成功處理程序中使用Trello.token()獲取令牌,並通過即你的服務器端代碼。它看起來像這樣:
// include whatever version of jquery you want to use first
<script src="https://api.trello.com/1/client.js?key=[your application key]" type="text/javascript"></script>
// call this whenever you want to make sure Trello is authenticated, and get a key.
// I don't call it until the user needs to push something to Trello,
// but you could call it in document.ready if that made more sense in your case.
function AuthenticateTrello() {
Trello.authorize({
name: "your project name",
type: "popup",
interactive: true,
expiration: "never",
success: function() { onAuthorizeSuccessful(); },
error: function() { onFailedAuthorization(); },
scope: { write: true, read: true },
});
}
function onAuthorizeSuccessful() {
var token = Trello.token();
// whatever you want to do with your token.
// if you can do everything client-side, there are other wrapper functions
// so you never need to use the token directly if you don't want to.
}
function onFailedAuthorization() {
// whatever
}
+0
這非常有幫助。非常感謝。 – Lokesh
0
如果你只需要供個人使用的令牌可以app-key
,secret
和token
根據你被記錄在了here得到。
相關問題
- 1. 易趣用戶令牌永久(取用戶令牌API)?
- 2. 如何使用java獲取永久Facebook訪問令牌
- 3. Facebook - 如何獲得永久用戶訪問令牌
- 4. Facebook洞察圖API,永久性令牌?
- 5. shopify - nodejs - 獲取永久令牌失敗
- 6. Facebook客戶端永久訪問令牌
- 7. 如何在圖形API中獲得永久訪問令牌
- 8. 如何使用用戶令牌獲取應用訪問令牌
- 9. 如何從Trello API檢索令牌
- 10. 如何使用LinkedIn Javascript API獲取用戶訪問令牌?
- 11. Trello api無效令牌
- 12. 如何使用OAuth1Swift讀取,寫入權限驗證Trello API用戶
- 13. 獲得永久的Facebook訪問令牌
- 14. 如何讓Instagram永久訪問令牌?
- 15. Trello API身份驗證未提供有效的用戶令牌
- 16. 訪問Trello API中的令牌時獲取無效簽名OAuth
- 17. 如何撤銷API v2.2的永久Facebook'頁面'令牌?
- 18. OAuth2中的永久訪問令牌
- 19. 使用MSAL獲取Graph API的令牌?
- 20. 如何獲取Windows SYSTEM用戶令牌
- 21. 獲取使用用戶令牌與C++
- 22. 迴環上的永久令牌
- 23. Tableau REST API:使用Javascript獲取令牌
- 24. 使用OneDrive API獲取訪問令牌
- 25. 使用PHP從BOX API獲取令牌?
- 26. 獲取用戶登錄訪問令牌以使用YouTube API
- 27. Twitter並PHP:永久訪問令牌
- 28. 如何從Facebook使用令牌獲取用戶ID的Android
- 29. RoR - 如何使用OAuth獲取Facebook用戶的訪問令牌?
- 30. 如何獲得永久頁面訪問令牌?
鏈接到文檔頁面:https://trello.com/docs/gettingstarted/index.html#getting-a-token-from-a-user –