javascript - How to manage server user session within client side single page app -


I am roaming with different client side technologies, like AngularJS, EmberJS, even using JQuery directly In addition to how to use ReactJS, besides my goal client and java jersey 2 jacks-rs back and api, make a single page app using jsn.

I have two stops now. I know some information..I am deploying my app as a war file in Jetty. The end of my back is Java based. I'm just using jquery in the client side as

My main hurdle is how to handle logging and session management, with using a comfortable API and AJAX, I am working with the installation of a cookie. My concern is with just one page app, it's just an index page, and if the user closes the browser, it opens again on the pointer page, while the cookie / session is still good, the user is logged in Should see, not out (not logged in) page, how can I handle it, whether it is a jsp page, some templatelabour library etc index.html, etc. With JSP, I can include some written code (against my best decision). In the old days I will include a header which request.getSession (). GetAttribute ("user") will check for it and if it was there .. User was using login and scalplet if () the code I display instead of the non-logged in header, log on to the top but I I am confident that nowadays it is a better way to do this with the client side's JS framework.

The other obstacle is block navigation and dynamic aspects. For example, when I was walking with angular JS, the use of {{name}} was easy to use, and the scope of the scope was changed with the JSON result value for the user's login. In my current situation, I'm not quite sure how to use the best type of $ ("# elem-id") apart from displaying dynamic bits like this with pure jquery. In addition to the success of the Code Ajax Call within InnerHtml = "..." feedback, I am not sure how to handle navigation on different pages. My login site will have some drop down menus or links that will replace the content area with different content of the content.

So first, what are some ways in SPA to handle user sessions, in case a page is reloaded, or restarted / to restart the crash browser .. to ensure that the user is still Also logged in and guides them to the right page? Second, what types of templates and routing / navigation options are available that do not require me to give an index.There is a huge ton code in the JSP page?

Thank you.

If you have a REST API as the last end, then you run OAuth as the authentication mechanism. Have to do. That is, when your user uses a username and password, you exchange that data with an authentication token. This authentication token is sent to your server with each API call and validates this token before completing your backend request. Clear till now?

What you can do when you receive an access token, you can also get access token end time from the server and store that data in your customer side app. Probably in local storage? And when your user closes the browser and repeats it again, you can first check that such access tokens are not available (and the time is not expired) ask the user before entering. This should solve your first problem.

Secondly, if you are looking for a light routing option, then I suggest.

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -