How to develop around Google API in GWT hosted mode? - google-app-engine

I've been developing a GWT project which uses Google APIs authorized by the App Identity API. This way, I can authorize my application backend to exploit the APIs needing authorization (e.g. Calendar, Mail, etc). I want to keep control of the data, I don't want users to need their authorization for the personal data.
It is very useful to use the hosted mode to develop GWT apps. But as far as I know, you won’t be able to hit the real calendar API using OAuth while running in hosted mode because the GAE dev server doesn’t simulate the Application Identity API.
But how about the other APIs? Has anyone used this approach? Can I simply create a mock for the Identity API and work with Calendar Java API in hosted mode?
It is unclear to me how to work around this problem. Any help would be greatly appreciated.

How about you create a Calendar Stub class.
In case you are running in the production environment,
the Stub class calls the Google API using the App Identity API.
In case you are running in the developer environment,
the Stub class calls a secret handler in your production app,
which then calls the Google API using the App Identity API.
All you basically need to create is a proxy handler in your production app.
You can have a shared secret between the dev and the prod environment
and use https to communicate.

Related

How to setup Google IAP between 2 Google App Engine Apps

I have a frontend project and a backend project. These are 2 separate app engine projects.
Setting up IAP on both is not problem but when my frontend project tries to call the backend project it is blocked.
Is there anyway to have access allowed to the backend project when the user passes the frontend IAP ? or do I have to leave the backend project without IAP enabled ?
You have to programmatically invoke (make the call using an OIDC token) to the backend from your front end. See documentation on how to do that.
There are misunderstandings. Let me clarify.
Firstly, your App Engine is highly scalable in a single project. Instead of having several projects with several App Engine, you should have only one project, with a single App Engine and multiple services.
Default is usually used for the frontend part. You can use an API service for your backend, or name it as you wish.
Like that, the whole website will be protected by the same IAP context. Like that, no issue as you have before, it's the same IAP cookies and the API calls should not create issues.
Secondly, keep in mind that your JS code runs in the client browser, not on App Engine; App Engine only serves the static files, that's all. All the rest of the computation is performed locally.

how can I use google app engine with an application in phonegap

I have been developing a Phonegap client application, I need to create a web service that storage all the data that i will be sending through the app.
I want to use google app engine to create the database and the web service.
I have read a lot, but i don't find a concrete example of how to do it and how to call the web service then from the application with phonegap.
Anyone have an example of how to do this?
You can use Cloud Endpoints with your app:
Google Cloud Endpoints consists of tools, libraries and capabilities
that allow you to generate APIs and client libraries from an App
Engine application, referred to as an API backend, to simplify client
access to data from other applications. Endpoints makes it easier to
create a web backend for web clients and mobile clients such as
Android or Apple's iOS.
For mobile developers, Endpoints provides a simple way to develop a
shared web backend and also provides critical infrastructures, such as
OAuth 2.0 authentication, eliminating a great deal of work that would
otherwise be needed. Furthermore, because the API backend is an App
Engine app, the mobile developer can use all of the services and
features available in App Engine, such as Datastore, Google Cloud
Storage, Mail, Url Fetch, Task Queues, and so forth. And finally, by
using App Engine for the backend, developers are freed from system
admin work, load balancing, scaling, and server maintenance.
It is possible to create mobile clients for App Engine backends
without Endpoints. However, using Endpoints makes this process easier
because it frees you from having to write wrappers to handle
communication with App Engine. The client libraries generated by
Endpoints allow you to simply make direct API calls.
Available in Python | Java
we have done similar thing for our Cordova/ionic based application. Its very simple and straight forward using javascript client of google cloud endpoint.

Google App Engine - custom URL for web clients, endpoints for mobile clients?

I'm developing an Android app and am using Google App Engine as the back-end. I want to use Endpoints since it seems easy to set up and appears to make authentication easy, but I've seen that it doesn't support custom domains. I'd like to use a custom domain to allow users to log-in and make changes with a web client, though not through Endpoints.
What I want to know is what they mean when they say that custom domains aren't supported. Does that mean you can't use Endpoints at all in your project if you've set up a custom domain for it, or that you just can't make Endpoints API calls to a custom domain?
If it's the latter, I've written a utility class that both my Endpoints API class and servlets could call, so my web client doesn't need to interact with Endpoints at all, only the mobile clients do. I'd like Endpoints and the servlets to be part of the same project so they can both access the same data in the Datastore.
If anyone knows whether this is possible or if there's a better way of going about this, I'd appreciate it. Thanks.
I tried it out and found that it is possible to use Endpoints in a GAE project that uses a custom domain, so long as the custom domain is not used to call the Endpoints API. So when it says in the Endpoints documentation that custom domains are not supported, it simply means you can't make API calls to a custom domain, as I suspected.

Does Google App Engine Support JAVA Proxy API's?

I have a question surrounding the REST service. I have an application written in C# , i want to put this application onto the cloud. I have a small problem, My Application has a built in C# API. I want to interact with my application and Google app engine. I want to develop a JAVA PROXY on top of GAE so that it can interact with my application using REST protocol and performs CRUD operations on Cloud and returns back data to my application.
Is it possible to do this ? to what i know is that SANDBOX feature doesn't allow us to directly interact with the App Engine.
Any suggestion on this.........
Thanks Heaps
Suraj
You don't need Java Proxy API in order to make http requests to another server (I guess you did not have java's Proxy class in mind?).
Yes, AppEngine can make HTTP/REST requests to other servers via URL Fetch java API.

Google App engine for mobile clients

Can I use GAE(Google App Engine) for developing a server for mobile clients? Mobile clients will send data to server every 10 seconds.
I am planning to develop the prototype using GAE and then depending on the results, will decide where to locate the prod server.
And are there any best practices to follow in developing code so that it will have very minimal dependancy with GAE (Can easily port to another environment with minimal code change when required)
thanks.
Ofcourse you can, GAE provides a good way to create a great backend for a mobile app.
about dependencies, you can use a project like django-nonrel, it creates an interface between your code and the API of GAE.

Resources