image Post Your Answer


image

Authenticate angular 4 application


Can Jwts used to authenticate angular 4 applications? Quick response will be appreciated.

All Answers (5 Answers In All)

By Deepthi G Answered 5 years ago

Yes. Jwts can be used to authenticate angular 4 applications.


By Manasa Answered 5 years ago

How is it used? Can you please explain?


By Deepthi G Answered 5 years ago

Sure. Just follow the below mentioned steps to authenticate angular 4 application. You have to send your credentials to the server which will be verified by the database credentials. If it is verified without any issue, the JWT will is sent back to you. JWT will be saved in your browser in local storage or in a cookie. JWT saved in the browser will be used as an indicator that you are currently logged in. The due time of JWT will be checked regularly to maintain an authenticated state within the Angular applications. The client side routes will be protected and accessed only by authenticated users. When you send XHR requests for APIs, the JWT will receive an authorization header using your cookies. When XHR requests are appearing on the server, before sending back the responses, it will validated with the app’s secret keys. You can also visit https://www.code-sample.com/2017/10/jwt-authenticate-angular-4-applications.html for more information.


By Manasa Answered 5 years ago

Can you provide me with a link that guides me on how to create a JWT session?


By Deepthi G Answered 5 years ago

Check out https://blog.angular-university.io/angular-jwt-authentication/.


Your Answer


View Related Questions