Intestazione di autorizzazione sconosciuta - Errore 401
-
31-10-2019 - |
Domanda
Accedo ai feed di fogli di calcolo di Google utilizzando il segno HMAC-SH1. Il mio codice è:
GoogleOAuthParameters oauthParameters = new GoogleOAuthParameters();
oauthParameters.setOAuthConsumerKey(CONSUMER_KEY);
oauthParameters.setOAuthConsumerSecret(CONSUMER_SECRET);
oauthParameters.setScope("https://spreadsheets.google.com/feeds/");
oauthParameters.setOAuthType(OAuthParameters.OAuthType.THREE_LEGGED_OAUTH);
oauthParameters.setOAuthToken(request.getSession().getAttribute("oauth_token").toString());
oauthParameters.setOAuthTokenSecret(request.getSession().getAttribute("oauth_token_secret").toString());
GoogleService googleService = new GoogleService("wise", "searceapps-searcegadget2-1");
googleService.setOAuthCredentials(oauthParameters, new OAuthHmacSha1Signer());
URL feedUrl = new URL("https://spreadsheets.google.com/feeds/spreadsheets/private/full/");
SpreadsheetFeed resultFeed = googleService.getFeed(feedUrl, SpreadsheetFeed.class);
Ma sto ricevendo l'errore:
Oauth.requestservlet doget: null com.google.gdata.util.authenticationException: OK Unknown Authorization Header
Intestazione di autorizzazione sconosciuta
Errore 401
at com.google.gdata.client.http.httpgdatare.handleerrorresponse (httpgdacarequest.java:600) su com.google.gdata.client.http.googlegdacarequest.handleerrorrerresponse (Googlegdacare.java: a Com.HTTP.Googlegdatarequest.HandlerRarresponse (Googlegdacare.java: a Com.HTPOOGINE.GAOGHE. .http.HttpGDataRequest.checkResponse(HttpGDataRequest.java:552) at com.google.gdata.client.http.HttpGDataRequest.execute(HttpGDataRequest.java:530) at com.google.gdata.client.http.GoogleGDataRequest.execute(GoogleGDataRequest .java: 535) su com.google.gdata.client.service.getFeed (Service.java:1135) all'indirizzo com.google.gdata.client.service.getfeed (Service.java:998) all'indirizzo com.google.gdata. Client.Googleservice.getFeed (googleservice.java:631) all'indirizzo com.google.gdata.client.service.getfeed (Service.java:1017) su oauth.accessfeeds.access (Accessfeeds.java:74)
Qual è il problema con questo?
Nessuna soluzione corretta