2014-09-22 69 views

回答

1

這不是採樣Ruby代碼,但描述瞭如何刷新令牌:

客戶端應用程序通過發佈另一個請求(4)https://login.salesforce.com/services/oauth2/token,此時與以下形式的有效載荷獲得一個新訪問令牌:

grant_type = refresh_token & CLIENT_ID = 3MVG9lKcPoNINVBJGKrUKSXjJRTgKoeZx6OvJLXwLO8n80_OY.ydx0cQ24zGwBhRfa4YEWrFaNVVdI142EivZ & client_secret = 7868057769520845245 & refresh_token = 5Aep861eWO5D.7wJBuW5aaARbbxQ8hssCnY1dw3qi59o1du7ob.lp23ba_3jMRnbFNT5R8X2GUKNA ==

grant_type Set this to refresh_token. 
client_id Your application's client identifier. 
client_secret Your application's client secret (optional). 
refresh_token The refresh token provided in the previous authorization. 

在接收到該訪問令牌,客戶端可以重複其請求(5),發送給用戶(6)的響應,並且進行服務請求(7,8,9),直到新的訪問令牌到期。

https://developer.salesforce.com/page/Digging_Deeper_into_OAuth_2.0_on_Force.com#Token_Refresh

+1

謝謝,但如何使用舊的令牌來獲取新的令牌,而無需用戶重新登錄 – user2630667 2014-09-24 11:16:45

+1

您可以配置在這裏刷新令牌策略重新授權:設置,單擊管理應用程序|連接的應用|刷新令牌政策 – John 2014-09-24 15:52:48

+0

再次感謝。在ruby中使用'databasedomcom gem'如何重新授權像樣本ruby代碼 – user2630667 2014-09-24 16:44:42