S
S
Sergey Pashkevich2016-10-07 12:26:04
Angular
Sergey Pashkevich, 2016-10-07 12:26:04

How to initialize data in Angular 2 application using JWT token?

Good time!
I am learning Angular 2 and trying to implement authentication using JWT token. Registration, authentication is successful (the token is placed in local storage and stored there), but there was a problem how to get this token when updating the page, send a request to the server to get up-to-date information about the user, and write this information to the service and only then start the application.
Where to implement this logic so that the application receives information about the user at startup?
If someone faced similar task, it would be interesting to know how you implemented it.
Thank you.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question