Authentication and session helpers in Webapp2?

I am trying to add authentication to a webapp2 application hosted on GAE. I have successfully completed the details requiring user registration, user registration, and logout functions. Since this is my first attempt to add authentication from scratch, I would like to get some tips on best practices. These are the following queries:

  • Are there any helpers in Webapp2. Something in the line of sight of helpers in RoR where helper functions are automatically available on every view / controller.

  • What is the correct way to check user login on each page? I was thinking of having an is_logged_in that ran on every page, checking the cookies stored in the user browser, and then checking. Is there a better way?

  • Finally, how / where do I use sessions? How is this useful?

What I know about authentication is what I learned in the current course in Udacity. The instructor, although he did not mention the sessions, talked about authentication using cookies.

Any pointers would be appreciated. Thank you very much.

+4
source share

Source: https://habr.com/ru/post/1411546/


All Articles