Using Google spreadsheet without authentication - java

All,
I have an application that is built on GAE, I want to use google spreadsheet (data) API to expose some reports. To do so I've been reading https://developers.google.com/google-apps/spreadsheets/ and trying to adopt it to my needs.
In my case really users who are looking at the reports are already authenticated by my application so I don't want to use OAuth 1.0 or 2.0 to authenticate them again. My use case is very simple.
- Users login to my application
- Then click on a link
- I generate a report in shape of a google spreadsheet and redirect user to the report page.
As I'm reading the documentation I can't figure how to do this without getting the user to authenticate again. Please note I don't want to create a document in user's google doc folder, I want to create one in my folder and have the to see it.
Thanks for your pointers.
Amir
Added: I was thinking about this and another challenge I guess is I have to adda document to my folder for each report and share it?! I was hoping I can simply stream the report to user's browser but I guess that's out of question!

If you want to generate the Google Doc in your own folder, then your authentication is what would be required on the backend, with a sharing level of public.

Related

Do I have to use the default google API authentication in a Java client application accessing a public sheet?

I'm creating a open source Java client application and I don't want to get data from a public read, only google sheet.
The users don't have to verify/login so I was wondering if there would be a way without any authentication at all.
If this isn't possible it would help a lot if someone could explain how I can create read only credentials for this one sheet.
In order to use Google APIs you need to identify your application to Google in all calls. This is because they need to know which application is using their api in order to avoid spamming or overloading of the server. In the event of private user data this is done by the credentials created when the user signed in. However with public data you can use an APK key this will only allow you read only access. You won't be able to write to anything unless you are authorised using Oauth, so as long as you are reading this sheet and only reading then you should be fine using an API Key.
However due to the fact that your project is open source you will not be allowed to include this API key in your project as its against Google's TOS. You will need to instruct your users on how to create their own API key. Can i really not include an API key in my open sorce project. which they can then use with your project.

Configure your OAuth client? (Google Sheets API)

I'm on the google sheets quickstart page and when I click on "Enable Google Sheets API" button it comes up with a menu called "Configure your OAuth client". There's a dropdown menu with a bunch of options like web browser, web server, ios, chrome app, etc. I'm new to programming with API's so I have no idea what this means. Which one should I use?
I'm making a web scraping program in the Eclipse IDE with Selenium and I want to dump my data I scrape into a google sheet. Any help would be appreciated
URL: https://developers.google.com/sheets/api/quickstart/java
In order to use any Google API, you need to create a Google Cloud Platform Project
Google offers two authentication ways
In most cases you will want use OAuth2 for safe authentication
You will need to obtain Credentials that will be used by the App to obtain the access and refresh tokens
To obtain credentials you need to set up the conset screen of you App first, as described here
The exact way depends on several factors, e.g. either you want to publish an external application or just use it for yourself and on which type of device you want to use it.
For most internal applications specifying the application type, the Application name and Scopes (can be edited later) is enough
The possible scopes for the Sheets API are listed here
For the beginning the easiest will be if you follow the quickstart for Java and set-up the Consent Screen by simply clicking on the Enable the Google Sheets API button
This will do all the configuration automatically in the background
Now, as the application type:
This depends strongly on how you want to implement the application - your choice will influence how the user will be redirected after authentication.
For testing on your local machine, Desktop App will mostly be the correct choice
I am not very familiar with Selenium, but for this kind of integration Web Server Application is likely the correct choice.
I recommend you to read how Google implements Web Server and Desktop applications to decide which type would be the appropiate one for you.

How to access Google Analytics API

I'm building a small Google App Engine application with the purpose of collecting statistics from a few sources, including page hits on our public web page via google analytics. I'm stumped though over how to access their API, I can't seem to make sense of googles new developers console regarding general structure and their new security rules.
Quick overview:
My application is java based and hosted in GAE and would like to access simple Analytics data. I'm not sure if the fact that it's a GAE application is relevant
The monitored site is NOT hosted in GAE and uses analytics.js.
My own google account has access to the statistics on https://www.google.com/analytics.
All documentation I find regarding accessing Analytics API (e.g. https://developers.google.com/analytics/devguides/reporting/core/v3/quickstart/service-java) points me to https://console.developers.google.com and setup things there. The problem is, only my own application exists in console.developers.google.com - not the monitored application. Is the docs valid only for GAE applications? Or can externally hosted applications be added to the console somehow? Is the console relevant for the client side of analytics?
What I'm looking for is any way to create API keys for my application to use - how is this done? Any step in the right direction is appreciated.
From DaImTo's comments (and the ones you posted after), seems like what you needed was :
"Its your own data go with a service account daimto.com/google-developer-console-service-account when its created take the service account email address add it as a user in the admin section of the Google analytics website at the ACCOUNT level it will then have access. You can use it with the core reporting api."
and this link
(just posting this as an answer in case the comments get trashed)

How to create login page in google app engine using java?

I would like to create my own login page instead of using the default one that is from google app engine. After the user click the login button, it will redirect them to the home page of my website. so is there a way to do so?
I am using java as programming language.
Would appreciate if anyone could help. Thanks.
Doing this in App Engine is no different to doing it in any other Java servlet environment, except that you're storing your user data in the datastore. How exactly you implement it is up to you and depends on a number of factors; a complete tutorial on how to build a user authentication system seems out of scope for a stack overflow answer.
I'd strongly recommend using a prebuilt authentication solution, however; if you don't like Google User authenticaiton, App Engine comes with built in OpenID authentication as an option. Rolling your own makes you responsible for issues like secure password storage, which is hard to get right, exposes your users to potential security issues, and forces them to create yet another user account instead of using an existing one.

Can anyone recommend an existing java file repository

that will allow my users to edit word documents locally in Word and have them saved back to the server when finished.
The project will be Grails based and I'm looking at things like WebDav but I would need security features that won't allow one user to access another users documents.
And unfortunately the test I ran opening a word document via a WebDav URL first downloaded the file rather than opening directly. So when saved, for example it just saved to c:\download\mydoc.doc.
So I'm looking for alternative ideas if anyone has any thoughts..
Look at this list http://java-source.net/open-source/content-managment-systems
Take a look on Alfresco.
Update
Enabled access protocols are listed in documentation and wikipedia.
CIFS/SMB
FTP
WebDAV
CMIS

Categories