O'Reilly logo

Learning Sinatra by Manoj Sehrawat, Sudeep Agarwal

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 9. Authentication and Authorization

In the previous chapter, you learned how to connect a Sinatra application with the MySQL database, what gems are needed, and the configuration options. You learned about the interactive console (irb) and saw how we can use it to interact with Sequel models and methods. We then covered various methods that Sequel provides for the model, both class- and instance-level. We also discussed associations and related optimizations. Now that you have learned about models, let's use them to create user-specific data by remembering the user across the pages and requests.

In this chapter, we will cover the following topics:

  • Using sessions
  • Handling authentication using sessions

Using sessions in Sinatra

We know that HTTP ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required