May 2018
Intermediate to advanced
512 pages
11h 3m
English
Now, let's build a local authentication service that will enable us to demonstrate a robust login form, caching, and conditional navigation concepts based on authentication status and a user's role:
$ npm install jwt-decode fake-jwt-sign$ npm install -D @types/jwt-decode
src/app/auth/auth.service.tsimport { HttpClient } from '@angular/common/http'import { Injectable } from '@angular/core'import { sign } from 'fake-jwt-sign' // For fakeAuthProvider onlyimport * as decode from 'jwt-decode'import { BehaviorSubject, Observable, of, throwError as observableThrowError ...Read now
Unlock full access