The Frontier logo The Frontier logo
06:58
Josh Justice

Rails APIs (Part 3) - Authentication

Josh Justice | Sep 10, 2018


How can I set up password authentication for my Rails web service?

In previous screencasts, we set up a simple Rails web service for todos and deployed it to production. But right now there's no authorization on it, which means anyone can come along and modify our data.

Let’s see this problem by sending a POST request to create a todo. We will use the Postman client that we discussed in a previous screencast. Even though we didn't provide any kind of authentication, we were allowed to create a record. That’s a problem.

In this screencast…

In this screencast, we’ll use the Doorkeeper gem makes it easy to add authentication to Rails APIs using the OAuth 2 standard.

After this screencast, you’ll be able to…

Add authentication to your Rails API with very little code.

Prerequisites

Basic knowledge or experience building frontend applications is recommended.

Additional Resources

Doorkeeper Gem
Rails has_secure_password method
OAuth2 password grant
Postman client