以前我可以使用消费者密钥和消费者密钥访问谷歌联系人。
GoogleOAuthParameters objParametersPro = new GoogleOAuthParameters();
ContactsService contactService = new ContactsService("App_Name");
objParametersPro.setOAuthConsumerKey(m_sConsumerKey);
objParametersPro.setOAuthConsumerSecret(m_sConsumerSecret);
objParametersPro.setOAuthType(OAuthType.TWO_LEGGED_OAUTH);
OAuthSigner objSignerPrp = new OAuthHmacSha1Signer();
objParametersPro.addCustomBaseParameter("xoauth_requestor_id",adminEmail);
contactService.setOAuthCredentials(objParametersPro, objSignerPrp);
contactService.setHeader("GData-Version", "3.0");
try {
String url="https://www.google.com/m8/feeds/contacts/"+domain+"/full/"+contactId;
entry = contactService.getEntry(new URL(url),ContactEntry.class);
} catch (Exception e1) {
e1.printStackTrace();
log.warning("exception in create entry obj"+e1);
}
但现在我必须使用oauth 2.0。任何人都可以拥有它或一段代码的示例吗?