Giter Site home page Giter Site logo

angularauthentication's Introduction

title type duration creator competencies
Angular Authentication
lesson
1:25
name city
Toneloke
LA
Programming, Server Authentication with tokens

Setting up authentication with Angular

Objectives

After this lesson, students will be able to:

  • Create their own auth service
  • Understand how to store tokens using local storage
  • Get an idea of how to setup your MEAN Stack applications
  • Add the token to every request using Angular middleware

Preparation

Before this lesson, students should already be able to:

  • Create a MVC app with Express
  • Create a schema with mongoose and create/read documents
  • Create authentication server side using JWT
  • Use Angular routes and understand SPAs

Authentication system

We've already implemented an authentication system in Express. For this lesson, we will use the previous backend api built with JWT.

For the beginning of this lesson we will be working out of the master branch. If you cannot keep up or have an error in the process, you can move to a branch and you should be caught up!

We will begin by taking a look at our folder structure and our backend.

Lets ensure everyone has a working api. We can send a post request to /api/sample , which will create a test user.

Test this out using postman. Play with token authentication explain how we use x-access-token in the header to send the jwt.

Start building the auth service, start with auth-token then auth-interceptor and finally auth which uses them.

Once the services are complete start to build out the mainController functionality. Ensure all services are added to the index.html and injected properly.

Build out the front end adding restriction to certain links and views based on the methods created in the mainController.

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.