A fully functional demo of Firebase v3 Web authentication viewable here. Sign in with Facebook, Github, Google, Twitter, password based, and anonymous accounts. The code, available on Github, is easy to read and follow and is well documented. The focus is on the fully functional authentication system.
Password based users are sent a validation link. They can also change their email address and password - both of these events send a verification email as an additional security measure.
Lastly, the difference between authentication, client side authorization, and server side authorization secured via Firebase Realtime Database Security Rules is demonstrated.
Prerequisites
Configure Your IDE
npm install -g firebase-tools
firebase login --no-localhost
firebase init
git clone https://github.com/rhroyston/firebase-auth.git
firebase deploy
href
, src
, and background: url
in all JS, CSS, and all HTML files depending on your Web hosting folder structure .
href
and src
and update as necessary.privateLink.href = "../firebase-auth/private"
the ..
seems to be required.Configure Firebase
https://my-app-1234/ack
.Login to Web app
demo.update('mynode','myKey','myValue')
method to add secure markup to your Realtime Database.
href
path to match your folder structure.demo.update("markup","secureData","<div class=\"mdl-card__title\"> <h1 class=\"mdl-card__title-text mdl-color-text--white\">Secured Data</h1> </div><div class=\"mdl-card__supporting-text mdl-typography--headline\"> <p>This is a secure card. The HTML markup that renders this card is secured in the Realtime Database. Access is determined server side so no matter what you do with JavaScript on your browser you will not be able to view this card unless you are authorized to.</p><p>Secured data can be markup, JSON, strings, numbers, etc. Your imagination is the limit!</p></div><div class=\"mdl-card__actions mdl-card--border intro-card-actions\"> <a class=\"mdl-button mdl-button--colored mdl-js-button mdl-js-ripple-effect\" href=\"../firebase-auth/\">Home</a></div>");
Login using each oAuth provider
Register as a Password based user
Logout