Google Drive Java Authentication - google-drive-api

I am trying to fetch access token and refresh token using the document specified here. While doing so, I am faced with an issue:
java.lang.NoSuchMethodError: com.google.api.client.json.JsonFactory.fromInputStream(Ljava/io/InputStream;Ljava/lang/Class;)
Where can I find the jar which contains this class and method?

The Google Drive Java client library is based on the Google APIs Java client library. Make sure you download it as well. The zip contains the library and all its dependencies.
Also make sure that you don't have conflicting versions of the Google Apis Client library in your compile/classpath as this method is only available in later versions.

Related

Shared library between UWP and REST api

I have a REST service that has many commands that can be called to return JSON data. I have a library of the DTO's that I use to build this JSON. I want to reference this library in my UWP app so that I can ensure they decode correctly. However I cannot reference the dll in my UWP app. I tried the backwards approach too, adding a UWP library to my REST service and referencing it in my UWP app, however then I cannot refrence it in the REST API. Any suggestions?
Move all your DTO's to a class library built using .Net Standard 1.4
This will allow you to share code between your REST service and UWP app.

How to retrieve my Install Statistics from the Google Developer's Console

I am trying to programmatically retrieve my company's app data from the Google Developer's Console, specifically the daily installs. I have found that Google recommends the gsutil tool to access the data programmatically through the Google Cloud Storage SDK. However, I beleive they charge for this service. I want a free way to programmatically retrieve the data, preferably as a JSON stream to avoid dealing with file downloads. I have found the "direct reporting" links, but I have problems authenticating when I try to use them, and I also have to do something with the actual files then.
Is there a way to get a JSON version of the data through OAuth2 or something without downloading an Excel file? Has anyone had to do this?
You should look into use the Core Reporting API.
There are client libraries available in a number of languages.
You should work through the Hello Analytics APIs to get started.
Java Script
PHP
Python
Java
A quick solution for building a dashboard would also be the Embed API.
Using the gsutil tool to access the company's storage bucket that are provided by google is a free service. I wrote a code that will run the gsutil code as a process through the command line and parsed the downloaded .csv files into a database for storage. OAuth2 was not necessary.

Google Drive API - Authorization for Downloads Post 1.70 Beta

I updated by Google Drive SDK references to 1.70 recently and updated all of my authentication code from using IAuthorizationState and the NativeApplicationClient to using UserCredentials, Drive.Auth.Store, and a DriveService object consistent with Google's "supported" method.
Everything working with my DriveService is working great. I can upload files, list files, create files and folders. Now I'm trying to figure out how to perform the simple act of downloading files by ID and I can't determine how I can leverage my new authentication code to support downloading. The SDK examples are referencing IAuthenticator but I'm not sure if that is a legacy object and my current project can't naturally reference it (missing a reference or perhaps isn't in 1.70).
I recognize that the Drive SDK may not actually have a method of downloading a file, but I'm very confused about how I can use my clean, new authentication store (Drive.Auth.Store) which has everything I should need to authenticate with the downloading action.
A point in the right direction would be most helpful! Thanks in advance for your help.

Get files from Google Drive SDK using C# .NET

I'm doing an application that access a google drive and get a file for my web application. I'm doing in C# .Net 4. Does anybody how to do this? Thanks
Please follow the C# Quickstart to start your project. It will guide you to set up authentication. Then, use Files.get() to retrieve metadata of the file which has downloadUrl to download content of the file. All sample code of retrieving metadata and downloading content is available in C# in the documentation for Files.get().

I am facing "The authenticated user has not installed the app with client id" error even after installing the app [duplicate]

I'm working on a Google Drive interface for Emacs. The concept is that Emacs could provide a platform-agnostic way to load, modify and save text documents stored in Google Drive. I've registered my app and can authenticate with OAuth2 and get a file listing with the Docs List API, but when I try to execute an Insert with the Google Drive API, I see an error:
"The authenticated user has not installed the app with client id ..."
Reading further, it seems I need to publish my Emacs application in the Chrome Web Store to get access to the Drive API. That doesn't make sense to me...I noticed that there is a FUSE project in development for Google Drive, which suggests that native development is possible. When I skimmed the code, however, I didn't see a Chrome Web Store component to getting it working.
Am I trying to misuse the API, or is there an route to make this work that makes more sense?
EDIT:
According to Ali Afshar, of the Google Drive team, installation is no longer required to use this API. So what follows may no longer be relevant, but will be left for historical purposes.
So, first off the API does not support application development in the sense that we are both doing it, I wouldn't use the word native though. The good news is I have been doing some research and Google Drive is really just a rebranding of Google Docs. So the Google Docs API could be a good choice as well for the same purposes.
Anyway, here's the steps to solve the error: "The authenticated user has not installed the app with client id ..." Which is a 403 error, for the sake of this answer. These steps assume you have set up an app in the chrome web store as is required, and installed it. I am working on my local machine too, with my project: http://github.com/tom-dignan/gdrive-cli which I have gotten past this error, so I think you should keep plugging away at your emacs version, because I think we can make this work.
a. Open the Google APIs console.
b. Confirm you've already enabled the apis under "API Access" both the API and SDK for Google drive should be enabled. There you get your client secrets/api keys and such. I am almost positive you've done this already, so go ahead to C. (this is here for others who may have missed it)
c. In the left navigation bar, under "Drive SDK" you will need to do the following:
Add a "Support URL" (required)
Add at least a small 16x16 application icon (required)
Add "OAuth Client ID (Required)" under Drive Integration (I was just tinkering and this seems to be the key field.)
Add "Open URL (Required) URL to open for your app from the google drive UI."
Check off "Multiple File Support"
Add some MIME types and file extensions, "text/plain", and txt for example
Add the the auth scopes:
https://www.googleapis.com/auth/userinfo.email
https://www.googleapis.com/auth/userinfo.profile
Don't bother trying to add the auth scopes for Google Docs here, because it won't work. Google does not want us to use it that way because files that drive apps create should be private to that app. Integration with Google Docs will have to be separate.
Now I know you must be thinking "why do I have to add some of these..." It's because the form makes them required fields. In mine, I put a couple URLs that point to static HTML pages.
Once you've done the above, clean up your state and reinstall your chrome app. Then try your code again, and it should stop giving you a 403.