我正在尝试使用以下“旧”代码从服务器使用 google-api 进行身份验证:
GoogleTokenResponse tokenResponse =
new GoogleAuthorizationCodeTokenRequest(TRANSPORT, JSON_FACTORY,
CLIENT_ID, CLIENT_SECRET, code, "postmessage").execute();
// Create a credential representation of the token data.
GoogleCredential
credential = new GoogleCredential.Builder()
.setJsonFactory(JSON_FACTORY)
.setTransport(TRANSPORT)
.setClientSecrets(CLIENT_ID, CLIENT_SECRET).build()
.setFromTokenResponse(tokenResponse);
从 google-api for java 的旧版本开始,JSON_FACTORY 是这样构建的:
JsonFactory JSON_FACTORY = new JacksonFactory();
但是由于我已经更新到 1.15.0-rc 版本,所以没有找到 JacksonFactory。看起来它已被重构或删除,但我找不到任何示例来替换这行代码。
我应该用什么?JsonFactory 的实现是肯定的,但是一些标准的实现可能已经存在?