Firebase Authentication on Google App Engine

Carlos Ribeiro
bawilabs
Published in
3 min readApr 27, 2017

Before anything else, we have to know is what exactly Firebase is. Perhaps, you already have heard about it, but for those who don’t know, there are a bunch of info about Firebase now-a-days, especially when it became a Google platform.

Today we can see the picture below and find all these services in Firebase UI management. As described, each of them grants you a lot of ideas to start building your apps, even if it’s a mobile or a web-service.

All features those makes Firebase incredible (Font: https://firebase.google.com/)

I just like the next picture so much, because of the pros and cons you can analyse between the standalone App Engine and Firebase or the mixing of both.

Table details the differences between the design patterns (Font: https://cloud.google.com/solutions/mobile/mobile-app-backend-services#design-pattern)

However, here we are going to focus on the authentication, which is incredibly simple and really useful. The following picture represents the data-flow of Firebase auth system alongside App Engine, Datastore and a server built in python.

The flow can be easily made with no such expert coding experience (Font: https://cloud.google.com/appengine/docs/standard/python/authenticating-users-firebase-appengine)

Let’s practice with a sample app. All the steps can be followed by the Google Cloud Platform documentation itself on:

Maybe you should encounter yourself with some issues when starting the app with the following command:

dev_appserver.py frontend/app.yaml backend/app.yaml

If you do, it’s just needed to login with your Google Cloud SDK account by installing it:

So, if everything is right you’ll able to see your App Engine running locally on http://locahost:8000/.

Gathered from local webpage App Engine

If you click on default or visit http://locahost:8080/ we can test the real authentication process. And depending on which providers you have set in your fronted configuration file, you can see something like that:

...
‘signInOptions’: [
firebase.auth.GoogleAuthProvider.PROVIDER_ID,
firebase.auth.FacebookAuthProvider.PROVIDER_ID,
firebase.auth.TwitterAuthProvider.PROVIDER_ID,
firebase.auth.GithubAuthProvider.PROVIDER_ID,
firebase.auth.EmailAuthProvider.PROVIDER_ID
]
...
Example of logins authentication view from the note-taking application

If you did an authentication with any of those buttons you should check your Firebase console of this app example and in Authentication menu over Users tab you can see all the authenticated users with their generated tokens.

Firebase console view from Authentication menu service

It’s not that hard, isn’t it?!

That’s what I found really helpful about Firebase! It can make our next systems better structured and robust with no hard code and simple to manage.

By now, that’s all I left for you! Hope to be back soon with a new integration service or something that make our work happier :)

--

--