簡體   English   中英

java.lang.RuntimeException:com.google.gdata.client.authn.oauth.OAuthException:oauth_token_secret不存在

[英]java.lang.RuntimeException: com.google.gdata.client.authn.oauth.OAuthException: oauth_token_secret does not exist

無法從Google獲取聯系人。

該代碼是根據google docs。

GoogleOAuthParameters oauthParameters = new GoogleOAuthParameters();
oauthParameters.setOAuthConsumerKey(CLIENT_ID);
oauthParameters.setOAuthConsumerSecret(CLIENT_SECRET);
oauthParameters.setOAuthToken(tokenData);
oauthParameters.setOAuthTokenSecret("");

contacstService.setOAuthCredentials(oauthParameters, new OAuthHmacSha1Signer());

當我打電話時:

ContactFeed resultFeed = contacstService.getFeed(feedUrl, ContactFeed.class);

獲取運行時異常。

我正在使用Google+ API進行記錄。

另外,我將如何設置訪問accesstoken機密?

例外::

java.lang.RuntimeException: com.google.gdata.client.authn.oauth.OAuthException: oauth_token_secret does not exist.
    at com.google.gdata.client.GoogleAuthTokenFactory$OAuthToken.getAuthorizationHeader(GoogleAuthTokenFactory.java:214)
    at com.google.gdata.client.http.HttpGDataRequest.(HttpGDataRequest.java:338)
    at com.google.gdata.client.http.GoogleGDataRequest.(GoogleGDataRequest.java:457)
    at com.google.gdata.client.http.GoogleGDataRequest$Factory.createRequest(GoogleGDataRequest.java:94)
    at com.google.gdata.client.http.HttpGDataRequest$Factory.getRequest(HttpGDataRequest.java:165)
    at com.google.gdata.client.Service.createRequest(Service.java:760)
    at com.google.gdata.client.GoogleService.createRequest(GoogleService.java:539)
    at com.google.gdata.client.Service.createFeedRequest(Service.java:1156)
    at com.google.gdata.client.Service.getFeed(Service.java:997)
    at com.google.gdata.client.GoogleService.getFeed(GoogleService.java:645)
    at com.google.gdata.client.Service.getFeed(Service.java:1017)
    at com.google.plus.samples.quickstart.Signin$PeopleServlet.contactsList(Signin.java:409)
    at com.google.plus.samples.quickstart.Signin$PeopleServlet.doGet(Signin.java:345)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:693)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
    at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:401)
    at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at org.mortbay.jetty.Server.handle(Server.java:326)
    at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
    at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:928)
    at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:549)
    at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
    at org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:228)
    at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)

我使用Google Contacts API,並嘗試將setOAuthTokenSecret設置為access_token ,它運行良好。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM