Skip to Main Content
Mastering TypeScript 3 - Third Edition
book

Mastering TypeScript 3 - Third Edition

by Nathan Rozentals
February 2019
Beginner content levelBeginner
694 pages
18h 4m
English
Packt Publishing
Content preview from Mastering TypeScript 3 - Third Edition

Using Observables in anger – of, pipe, and map

We now have a REST endpoint that can verify our JWT token. What we need to do, then, is to call this endpoint from our Angular application to ensure that the user that is logged in has a valid JWT token. Remember that when we log in, we store this token in Local Storage, and redirect to our SecureComponent. The SecureComponent is protected by our AuthGuard, which checks for the existence of this token. We therefore need to contact our Express server, which generated this token, in order to verify it.

The most obvious place to put this code is in the AuthGuard itself, so that any attempt to access the SecureComponent will need to verify the JWT token by POSTing to our Express server before continuing. ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

The TypeScript Workshop

The TypeScript Workshop

Ben Grynhaus, Jordan Hudgens, Rayon Hunte, Matt Morgan, Wekoslav Stefanovski

Publisher Resources

ISBN: 9781789536706Supplemental Content