服務器從移動應用程序接收到one-time authorization code。我需要將其轉換爲spring-social訪問令牌並刷新令牌,並將它們保存在服務器數據庫中供以後使用。Spring Social Google - 將一次性授權碼轉換爲服務器上的訪問令牌/刷新令牌
我當前的代碼:
String oneTimeAuthorizationCode= "xxx"; // provided by mobile client
ConnectionData cd = new ConnectionData("google", null, null, null, null, oneTimeAuthorizationCode, null, null, null);
GoogleConnectionFactory googleConnectionFactory = (GoogleConnectionFactory) connectionFactoryLocator.getConnectionFactory("google");
Connection<Google> connection = googleConnectionFactory.createConnection(cd);
// get the google API and work with it
Google google = (Google) connection.getApi();
oneTimeAuthorizationCode是錯誤的,因爲ConnectionData期待一個訪問令牌,而不是一次性的授權碼。任何想法如何讓spring-social-google爲訪問令牌和刷新令牌交換一次性代碼?