I have written some custom apis for my application. Now i am implementing login/register feature in java. (I am not good in java)
Some of application which i have developed earlier in laravel (PHP framework) having the following flow :
User signIn into the SPA application, On successful login we create a token and expiry time, and save them in DB and return them in response. On the front end we keep the token into localStorage.
On every api request we append the token as payload and the application middleware authenticates the token with DB.
If token is valid with expiry time, then user is genuine user else logout the user and redirect to login.
Should I use the same approach in java too? Or there is some other mechanism. Please suggest.
Question
rahul7827
Hello Team
I have written some custom apis for my application. Now i am implementing login/register feature in java. (I am not good in java)
Some of application which i have developed earlier in laravel (PHP framework) having the following flow :
User signIn into the SPA application, On successful login we create a token and expiry time, and save them in DB and return them in response. On the front end we keep the token into localStorage.
On every api request we append the token as payload and the application middleware authenticates the token with DB.
If token is valid with expiry time, then user is genuine user else logout the user and redirect to login.
Should I use the same approach in java too? Or there is some other mechanism. Please suggest.
Link to comment
Share on other sites
Top Posters For This Question
2
1
1
Popular Days
Feb 24
2
Feb 18
1
Mar 4
1
Top Posters For This Question
rahul7827 2 posts
Burak 1 post
Connessione 1 post
Popular Days
Feb 24 2023
2 posts
Feb 18 2023
1 post
Mar 4 2023
1 post
3 answers to this question
Recommended Posts