Reputation: 31
I have 2 pages. One page is for registration and the second is for User detail. On the registration page, the user will enter his details and register. My problem is after registration I want to redirect the user to the detail page where only registered users can see their information.
I am using JWT for authentication. After registration when I receive token I do not know how to pass it on to the next page. I want to set a header for the token. but after receiving token when I set header then this header lost when I redirect on next page. I am not sending any ajax request and also I am using simple html and hbs for template engine.
Upvotes: 0
Views: 823
Reputation: 1337
If you are not working on REST APIs
, you can use the session for the authentication of the user.
So that everything will be handled in the backend. Passport
is a good package for handling the user authentication.
Upvotes: 1
Reputation: 884
Note: Go through about Interceptors
Upvotes: 1