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 • Rails 7 API Tutorial - Create project...
📖 You can also purchase the eBook and code for the new Rails 7 tutorial - https://tomkadwill.gumroad.com/l/rail...
This video covers:
00:00 - Introduction
00:30 - Recap how the /authenticate endpoint works
01:36 - Making API endpoints require authentication
01:52 - Adding a before_action to check authentication
03:32 - Authentication Bearer "token" scheme
04:36 - Parsing the Authentication header and fetching the token using token_and_options
06:55 - Updating the specs to include an authentication header
08:29 - Adding logic to decode the JWT (that's been fetched from the header) and extract the user_id
12:41 - Updating the specs to pass a real JWT in the header
14:28 - Using the user_id to do a database lookup with User.find and resuing exceptions
16:26 - Testing it out with cURL
If you’re new to this series, you may want to start with part 1: • Rails 6 API Tutorial - Create project...
コメント