Nuxt.js Authenticate with JWT
[Login]
- login process with passport
--> req.user is generated automatically by passport - create route for '/auth/token' for get jwt token with req.user
- create nuxtServerInit for fetching token and set token to store.state
- check authenticated by middleware
[Logout]
- create route for '/auth/logout' includes followings:
router.get('/auth/logout', (req,res)=>{
req.logout()
req.redirect(>>front main url or sign-in url<<)
...
}) - delete token and other user-info from state.store
- window.location.replace( BACKEND+'/auth/logout')
Congratulations @dirmich! You received a personal award!
Click here to view your Board of Honor
Do not miss the last post from @steemitboard:
Congratulations @dirmich! You received a personal award!
You can view your badges on your Steem Board and compare to others on the Steem Ranking
Vote for @Steemitboard as a witness to get one more award and increased upvotes!