Premium lesson

The Fundamentals of Authentication

Express.js·4 min read·Jan 1, 2025

In programming, authentication is the process of verifying the identity of a user or system.

It is usually coupled with authorization, which is the process of determining whether a user or system has permission to perform a specific action or access certain resources.

These processes allow systems to control and limit the access to the resources, services, or actions, as well as personalize the user experience based on individual preferences.

For example, authentication can be used to allow a user to connect to their banking app, and authorization can be used to deny them certain types of operations on their accounts.

How does authentication work?

When attempting to access a protected resource or service, users must prove their identity (who they claim to be) by providing a piece of information called credentials.

These credentials exist in a variety of forms and durations, such as email and password pairs, security tokens, one-time codes, certificates, and so on.

During authentication, the credentials provided by the user are compared to those on file in a database.

If the credentials match those on file and the authenticated entity is authorized to use the resource, the user gains access.

Stateless authentication

Stateless authentication is a common authentication method for applications that communicate over the HTTP protocol, where the server does not store any session-related information about the user.

This process is as follows:

  1. The user provides their credentials, typically an email and password pair.

  2. The server verifies the credentials against a database to confirm the user's identity.

icon light bulb key

Unlock the Build RESTful APIs in Node.js module

Learn how to build real database-backed and framework-powered RESTful APIs with MySQL, Sequelize, and Express.

You get immediate access to:

  • 37 focused lessons across MySQL, Sequelize, backend, and Express
  • 4 real-world projects with commented solutions
  • Ongoing updates to this bundle
  • Lifetime access to this bundle
Unlock this module