Handling authentication using session

You have learned about the session object and its methods; now we know that if we need to store something across the requests, we can store it in the session. In this section, you will learn how to build a simple authentication system for your application using sessions.

What is authentication and authorization?

Authentication is a process that ensures and confirms a user's identity based on the provided credentials (username and password). On the basis of the username and password, we can figure out that the user with the provided credentials exists, we have found our current user for the request, and this user will be called an authenticated user.

Authorization is the process of giving individuals access to ...

Get Learning Sinatra now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.