My flow is login page -> home page.
Login page has no token, after logging in, server provides token and user is redirected to home page.
Home page sends the token to server, token is verified, server sends back data to display on front end.
Problem:
HttpInterceptor firing on login request Cannot read property 'token' of null
. I would like to have the interceptor somehow ignore the login api request and only intercept on subsequent calls if token exists.
hello you can a key value in your header to distinguish login from other requests, and create an interceptor to check if that key exist to delete the token
then create your interceptor
and add it to your app module providers
Working Solution
auth.interceptor.js
service.ts