This samples shows how to serve server-side generated HTML pages using the HandlebarsJs templating system.
It also shows how to serve user specific content by passing the Firebase ID token of the signed-in user in a __session
cookie.
Checking and decoding the ID token passed in the __session
cookie is done with an ExpressJs middleware.
Some custom scripts in [functions/views/layouts/main.handlebars] maintain the Firebase ID token in the __session
cookie.
- Create a Firebase Project using the Firebase Console.
- Enable the Google Provider in the Auth section.
- Clone or download this repo and open the
template-handlebars
directory. - You must have the Firebase CLI installed. If you don't have it install it with
npm install -g firebase-tools
and then configure it withfirebase login
. - Configure the CLI locally by using
firebase use --add
and select your project in the list. - Install dependencies locally by running:
cd functions; npm install; cd -
This sample comes with a web-based UI for testing the function. To test it out:
- Deploy your project using
firebase deploy
- Open the app using
firebase open hosting:site
, this will open a browser. - Sign in the web app in the browser using Google Sign-In and some user information will be displayed on a server-side generated page.
We'd love that you contribute to the project. Before doing so please read our Contributor guide.
© Google, 2017. Licensed under an Apache-2 license.