Meteor Authentication System
Explore how to set up and manage user authentication in Meteor.js applications. Learn to create accounts, handle login and logout, and use React's context API for maintaining authentication state across the app. This lesson guides you through adding Meteor's accounts-password package and integrating secure user management in your full-stack project.
We'll cover the following...
Meteor authentication
Authentication is a means of identifying an application’s users before granting access to web resources. Meteor provides a built-in way to add user functionality without having to write an authentication system ourselves. The basic workflow of a web application provides a mechanism for users to log in and register accounts.
Not every application needs authentication, so the user authentication functionality isn’t available by default in created projects. We need to install the account functionality through the terminal. We’ll create a little app, install the Meteor account package, and get familiar with the package before installing it to the online bookshop application that we’re building throughout this chapter.
We’ll install a login provider on the terminal by typing meteor add accounts-password. Meteor creates a users collection in MongoDB after the installation of the accounts-password package. This collection is used for the management of users’ accounts.
The coding playground at the end of this lesson implements authentication in a MeteorJS application. We have a Meteor Method called createAccount inside the imports/api/methods.js file. On line 2, we import Accounts from ...