Configure your OAuth client? (Google Sheets API) - java

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.

Related

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)

User profile login solution for Java/Spring app

I'm developing a web application in Java, using Spring Framework. I'm adding personalization to my site, and I'd like to provide my users the best experience. Features I'm looking for:
Support for logging in using popular services (at least Facebook and Google)
Support for creating a username/password
Support of tying multiple credentials (i.e. the same account can have FB, Google and username/password)
Reset password feature
Remember-me feature
Nice login widget (like Stackoverflow's for instance)
Secure storage of passwords
JSP integration (i.e. login tag, conditional "is-logged-in", "has-permission-x" tags)
Support for integrating in my schema
Mobile support (usable from mobile browsers)
Open source
I realize Spring Security/Spring Social has some of this (and they overlap a bit).
Yes, spring-security, spring-social, spring-mobile, openid4java, and a javascript openid library cover your requirements. But you still have to write code and configure stuff. It's not "ready-to-use". You can start with spring-roo that will generate some skeleton project on which you can build forward.

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.

OpenSocial, Facebook Platform and other APIs for Java console application

I would like to try to use OpenSocial (or any other API) for my small project. What I want to create is a small console application that would gather some data from several sites (e.g., Facebook, LinkedIn, Xing, MySpace...) and calculate some things. What I've noticed in all tutorials is that OpenSocial is used for mobile applications, apps inside social networks etc., but I haven't seen it anywhere to be used for a console application. Is that possible? Can I create a simple Java console application which would gather and process data from social networks? Do you know some tutorial that could help me out with it? The biggest problem that I have is the authentication, since (if I understood well) all APIs request to forward the user to the original (e.g., LinkedIn) site to login so to grant permission to use the data for the application. But can I somehow login with my credentials using a console application?
Thanks,
Ivan
Yes, you can access the various data APIs from a stand alone Java application. The standard/protocol you're looking for is OAuth, not OpenSocial.
You will have to give your users some way to grant access to their social network account. (web based applications would redirect them to the social network site, which would in turn redirect them back to the application). OAuth has an out-of-band (OOB) mode especially for non-web based consumers.
I've used Scribe in the past to access the LinkedIn API.

Using Google AppEngine as a "cache" for personal websites (wordpress blogs, wikis)

I read an article of an indie game developer who is using Google AppEngine to cache his main site and blog, to protect provide high-availability during traffic spikes (Digg, Slashdot effect).
Wolfire Blog - Google App Engine for Indie Developers
There's not a lot of detail on the exactly what they developed in Python on Google AppEngine that they used to cache the site. The only details I could find were about the AppEngine python app reading the backend wordpress articles through an RSS feed:
Wordpress runs on a dedicated server,
and we import it into www.wolfire.com
via RSS, which is the App Engine part.
Dumping Wordpress entirely is on my
list though of things to do someday.
;)
Does anyone know of any open source Python or Java web frameworks that you can use to customize caching a site that you could build and deploy on Google AppEngine to act as a "scalable" provider for your web content?
I'm using an "Ok" shared hosting service called bluehost to host my wordpress blog, I'd like to be able to instead put my blog on a separate domain (blog.ddaniels.net) and host google app-engine on www.ddaniels.net that would point to blog.ddaniels.net.
This could be extended for almost any type of website, you would still need links to dynamic content to point to the original host (for things like comments and editing wiki pages etc, basically any HTTP PUT type operations).
I'd assume you'd basically need a Java or Python framework that you could:
Configure your back end host e.g. blog.yourname.com
Configure Google App Engine framework as www.yourname.com (details for Google App Engine mapping to your domain, the key is you have to use subdomains and "www" is a subdomain)
On first access of page (or after expiration time) HTTP GET the page from backing host and cache it on Google AppEngine
You could start by taking the code for DryDrop, which mirrors static pages from a repository hosted on GitHub, and making it a more general reverse proxy. For example, you'd need to ensure that POST requests or logged-in users get passed through directly to the proxy.

Categories