What’s included in SitePoint Premium?

User Authentication with the MEAN Stack

What’s included in SitePoint Premium?

  • Read offline (beta)
  • 250+ books
  • 120+ courses
  • New content added weekly
  • Ad Free SitePoint
  • Cancel anytime
  • 30 Days Money Back Guarantee!


    In this tutorial, we’re going to look at managing user authentication in the MEAN stack. We’ll use the most common MEAN architecture of having an Angular single-page app using a REST API built with Node, Express and MongoDB.

    When thinking about user authentication, we need to tackle the following things:

    1. Let a user register
    2. Save user data, but never directly store passwords
    3. Let a returning user log in
    4. Keep a logged in user’s session alive between page visits
    5. Have some pages that can only been seen by logged in users
    6. Change output to the screen depending on logged in status (for example, a “login” button or a “my profile” button).

    available in: