Coder Social home page Coder Social logo

express-authentication-firebase's Introduction

express-authentication-firebase

MIT week 26 firebase assignment for express and firebase authentication

A basic frontend form (index.html) A server file (index.js) An admin configuration file (admin.js) A login.js configuration file (login.js)

At a high level, you will:

Take the token presented to browser client Add the token to the HTTP header Pass the token to the back end Use a Firebase package to verify the token

View the server file, index.js. There, you will see that Express is required along with two routes. One route is not authenticated (the open route) and one route is authenticated. You can see that the authenticated route needs to examine and verify the token that is being passed in.

Install your packages

Now, install express and the firebase packages. Do so by running the following commands in your command line:

npm install

npm i firebase

npm install firebase-admin --save Note: you can see the dependencies for the project that get installed with this command by looking at the dependencies section of the package.json file.

  1. Run your server and test your routes

To run your server, run the following command:

node index.js

Then, navigate to localhost:3000/login.html Screenshot 2021-11-18 at 6 16 14 PM Screenshot 2021-11-18 at 6 13 41 PM Screenshot 2021-11-18 at 6 11 34 PM Screenshot 2021-11-18 at 6 11 01 PM Screenshot 2021-11-18 at 6 10 36 PM

MIT-Auth-Routes.json contents have been deleted so you need to go to firebase and generate a new project and new private key under Service Accounts. Please keep this info strictly private.

apiKey, messagingId, and appId also deleted so you need to go to your firebase project and copy your configurations to login.js file

express-authentication-firebase's People

Contributors

powerlesbian avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.