【发布时间】:2014-08-29 09:15:34
【问题描述】:
服务器从移动应用接收one-time authorization code。我需要将其转换为 spring-social 访问令牌并刷新令牌并将它们保存在服务器数据库中以供以后使用。
我当前的代码:
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 用一次性代码交换访问令牌和刷新令牌吗?
【问题讨论】:
标签: java spring spring-social google-signin spring-social-google