服务器从移动应用程序接收到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为访问令牌和刷新令牌交换一次性代码?