Jump to content
  • 0

How to Implement authentication in custom api (as plugin)?


rahul7827
 Share

Question

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

  • Answers 3
  • Created
  • Last Reply

Top Posters For This Question

Top Posters For This Question

3 answers to this question

Recommended Posts

  • 0

You can look into creating a rest api service through plugin (using sampleplugin as example). Everything else will be same as php app. Since you are not dealing with sessions you don't need to worry much.

Link to comment
Share on other sites

 Share

×
×
  • Create New...