Token Based Authentication Steps As - User enters their login credentials and the server verifies the entered credentials. Validating to the entered credentials, It’s correct or not. If the credentials are correct, returns a signed token. This token is stored local storage in the client side. We can also store in session storage or cookie. Example As – private _setSession ( authResult , profile ) { //Save session data and update login status subject localStorage . setItem ( 'access_token' , authResult . accessToken ); localStorage . setItem ( 'id_token' , authResult . idToken ); localStorage . setItem ( 'userProfile' , JSON . stringify ( profile )); this . setLoggedIn ( true ); } Advantages of Token-Based Authentication - 1. Stateless, 2. Scalable 3. Decoupled 4. ...
Angular, React, JavaScript, Java, PHP, SQL, C#, Vue, NodeJs, TypeScript and Interview Questions Answers