4

I'm trying to add authentication in a webapp2 app hosted on GAE. I've successfully completed parts requiring registering a user, logging him in as well as a logout feature. Since this is my first attempt at adding authentication from scratch, I would love to get some advice about best practices. These are the queries I have:

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

  • What is the right way of checking if user is logged in at each page? I was thinking of having a is_logged_in helper which would run on each page by checking against the cookies stored in the user's browser and then validating. Is there a better way?

  • Finally, how/where do I use sessions? How is it helpful?

What I know about authentication is what I learnt in the on-going course at Udacity. The instructor though didn't mention sessions and spoke about authentication using cookies.

Any pointers would be appreciated. Thank you so much.

jmlane
  • 2,109
  • 1
  • 16
  • 24
Prakhar
  • 3,486
  • 17
  • 44
  • 61

0 Answers0