Rails 6 API Tutorial - Finding the user and adding their ID to the JWT payload p.21

preview_player
Показать описание
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.

This video covers:
00:00 - Introduction
00:13 - Generating a User model
00:59 - Finding the user, from params, in the authentication controller
01:37 - Calling AuthenticationTokenService and passing in the User ID
02:22 - Running the migrations
02:56 - Using FactoryBot to create a user in the specs
05:01 - Updating AuthenticationTokenService to receive user_id and add it to the JWT payload
06:25 - Fixing the AuthenticationTokenService spec
07:41 - Deleting unused pending spec
08:05 - Creating a User in the DB, in order to manually test authentication
08:48 - Testing the authenticate API via cURL
10:47 - Updating the controller to return the JWT generated from AuthenticationTokenService

Рекомендации по теме
Комментарии
Автор

Appreciate all the live coding and great work!

liondancer
Автор

i'm loving this series. Simple and easy to follow. Thaks for this content, Tom.

znh_
Автор

Thanks man, this series helped me a lot ❤

ahmedmustafa
Автор

Thank you from India. I am new to both backend development and Rails. I was looking for a tutorial for using Devise and JWT, but most of what I found here was not for API only Rails. Is it any better to use Devise together with JWT? Would appreciate it if you could do a tutorial on that any time soon

MsDanny
Автор

can i use rails api to connect to an existing rails app with the same database ?

IAmADreamerish
Автор

How can we upload videos and count views on videos if it has been watched fully? Can you make videos on that or do you have any resources?

prasangathapaliya
Автор

all the tests have been passed, however, I can not POST. I have the error: curl: (7) Couldn't connect to server

brunagobi