Web Developer

Section 20 Authentication

Check email sign up and login API: google, key words: “firebase authentication rest api”

Check loading spinner: google, key words: “css loading spinner” (https://loading.io/css/)

Base on the REST API documentation, set up endpoint, data body…

rxjs operators: tap, take, exhaustMap

BehaviorSubject: always keep the last nexted data

save data to local storage: localStorage.setItem/getItem/removeItem

HttpInterceptor: auto add data to outgoing request, it can attach authenticated token to the header or query string of the request URL

Add CanActivate guard to check whether authentication is true, then to decide whether it should be render the page. For CanActivate guard, it not only can return boolean, but also if not true, it can return URLTree, which could redirect to new page. Note: the old method is using tap operator to redirect route.