google-api-java-client

drive.changes().watch returns GoogleJsonResponseException: 401 Unauthorized without any message

落爺英雄遲暮 提交于 2019-12-01 10:52:38
I'm trying to watch for changes in Google Drive, and getting 401 Exception. Searching here, i found that people have detailed messages, why they are not unauthorized though i have nothing. Here the code i use: public static void main(String[] args) { try { httpTransport = GoogleNetHttpTransport.newTrustedTransport(); dataStoreFactory = new FileDataStoreFactory(DATA_STORE_DIR); // authorization GoogleCredential credential = GoogleCredential.getApplicationDefault() .createScoped(DriveScopes.all()); boolean refreshed = credential.refreshToken(); // set up the global Drive instance drive = new

Using Google API Java Client on Android, a POST request does not seem to authenticate with Google App Engine app using OAuth

我与影子孤独终老i 提交于 2019-12-01 09:05:28
I have an Android client that needs to authenticate with a python Google App Engine app using OAuth. I followed this article . And was able to successfully do so using an HTTP Get Request. The Android client uses the package com.google.api.client to accomplish this: OAuthHmacSigner _signer; HttpTransport TRANSPORT = new NetHttpTransport(); _signer = new OAuthHmacSigner(); _signer.clientSharedSecret = CONSUMER_SECRET; // STEP1: get a request token OAuthGetTemporaryToken requestToken = new OAuthGetTemporaryToken(REQUEST_TOKEN_URL); requestToken.consumerKey = CONSUMER_KEY; requestToken.transport

Google Admin SDK 403 Not Authorized to Access this Resource/API

你。 提交于 2019-12-01 05:31:18
问题 I use the following code in a java web application to try to get all users of a group: GoogleCredential credential = GoogleCredential.fromStream(Util.class.getResourceAsStream("[credential_file].json")).createScoped(SCOPES); Directory directory = new Directory.Builder(httpTransport, JSON_FACTORY, credential).build(); Directory.Members dirMem = directory.members(); Members members = dirMem.list("[group_email]").execute(); This results in an exception 403 (Not authorized to access this resource

Stored Credential from google api to be reused java

∥☆過路亽.° 提交于 2019-12-01 03:26:11
I have successfully authorized my desktop application. It stores a file called StoredCredential . In order to not have to keep doing the copy URL into browser, accept, etc., steps every time I run the app, I want to use the credentials that I already have stored. My code so far: GoogleAuthorizationCodeFlow flow = new GoogleAuthorizationCodeFlow.Builder( httpTransport, JSON_FACTORY, CLIENT_ID, CLIENT_SECRET, SCOPE) .setDataStoreFactory(dataStoreFactory) .setApprovalPrompt("auto").setAccessType("offline").build(); // System.out.println("flow success"); String url = flow .newAuthorizationUrl()

Google Gmail API - Delegation settings

给你一囗甜甜゛ 提交于 2019-12-01 01:08:56
Apologies if this is covered elsewhere and I have missed it. Google's Email Settings API is deprecated and set to be turned off on July 7, 2017 . With this date looming, I have started investigating migrating our local delegated account management web application to the new API. As you might expect, this applications allows users to list, add and delete delegate access to a Gmail account. It currently uses the OAuth 2.0 scope of. https://apps-apis.google.com/a/feeds/emailsettings/2.0/{domain}/{username}/delegation However, the delegate section of the migration guide , written in July 2016,

How to POST request to Google Shortener API with Google API Java Client and parse a JSON response?

北城余情 提交于 2019-12-01 00:31:47
I want to use the Google Shortener API . I want to use the google api java client library to post a request and parse the JSON response. Next, I post the code I have tried: import java.io.IOException; import net.sf.json.JSONObject; import com.google.api.client.googleapis.GoogleHeaders; import com.google.api.client.googleapis.GoogleTransport; import com.google.api.client.googleapis.json.JsonCParser; import com.google.api.client.http.HttpRequest; import com.google.api.client.http.HttpResponse; import com.google.api.client.http.HttpTransport; import com.google.api.client.json.JsonHttpContent;

javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake while inserting rows in bigquery

冷暖自知 提交于 2019-11-30 17:03:43
Hi I am working on android app in which I have integrated bigquery. I see sometimes we are getting a lot of SSL exceptions while inserting data to big query tables. I don't know how to handle this . Please help what exactly is the cause of this problem. Here is the same thread but no answer Bigquery SSL error while doing streaming insert api call javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:946) ~[na:1.7.0_51] at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1312)

Get Google Calendar Events Start and End Times with google-java-api-client in Android

佐手、 提交于 2019-11-30 15:43:25
How would one go about parsing the start and end times of events in a users Google Calendar using the google-api-java-client? After installing this sample android project from Google code, I can get into my Google calendar and parse some information, (like all the calendars, the event names, when it was published, and the summary), but I cannot for the life of me get the event start and end times. My understanding of the code is as such. Inside the main activity class (CalendarAndroidSample.java) this is the method that gets the title for each of my calendars: void executeRefreshCalendars() {

How do I request paginated BigQuery query results using pageTokens with the Google Client lib for Java?

隐身守侯 提交于 2019-11-30 09:48:19
I want to run BigQuery queries with thousands of rows of total results, but I only want to retrieve a page of 100 results at a time (using the maxResults and pageToken parameters). The BigQuery API supports the use of pageToken parameters on collection.list methods. However, I am running asynchronous queries and retrieving the results using the getQueryResult method, and it doesn't seem to support the pageToken parameter. Is it possible to use pageToken s with getQueryResults ? Michael Manoochehri Update: There's new documentation about how to page through list results here . I am self

Google Java API conflicted with ColdFusion CFHTTP?

独自空忆成欢 提交于 2019-11-30 09:34:38
问题 I tried copying all those JAR's found in the google-api-client-assembly-1.20.0-1.20.01.zip (downloaded from https://developers.google.com/api-client-library/java/google-api-java-client/download) to {cf_root}/lib , restart ColdFusion, and everything loaded up fine. However, when I used <cfhttp> : org.apache.catalina.core.StandardWrapperValve invoke SEVERE: Servlet.service() for servlet [CfmServlet] in context with path [/] threw exception [org.apache.http.impl.client.DefaultHttpClient