Back to Browse

Rails 6 API Tutorial - Building an Authentication Endpoint p.19

5.7K views
Nov 26, 2020
15:10

In this video series we will build a Rails API from scratch. Backend APIs are useful for serving data to frontend applications, mobile apps or other backend services. ✨ Check out the new version of this video series, which has been updated for Rails 7 https://youtu.be/FJiIvFoxqsc 📖 You can also purchase the eBook and code for the new Rails 7 tutorial - https://tomkadwill.gumroad.com/l/rails-api-tutorial This video covers: 00:00 - Introduction 00:27 - Adding a request spec for authentication 02:29 - Adding an /authenticate route 03:34 - Adding an AuthenticationController with 'create' action 04:45 - Updating the spec to post username and password params 05:49 - Updating the spec to check the response code is :created 06:24 - Adding an expectation to check the response body contains a token 07:15 - Adding 'render :json' to the controller, with token and status 08:00 - Adding a test for the case where user doesn't provide username/password 10:36 - Using required params in the auth controller 12:06 - Adding a rescue_from block to catch ParameterMissing and return error response 14:08 - Adding expectation to check the response body includes missing param message If you’re new to this series, you may want to start with part 1: https://youtu.be/6KqbPJtA5O8

Download

1 formats

Video Formats

360pmp421.4 MB

Right-click 'Download' and select 'Save Link As' if the file opens in a new tab.

Rails 6 API Tutorial - Building an Authentication Endpoint p.19 | NatokHD