Is there like a Laravel Passport in rails?

  laravel, ruby, ruby-on-rails

I’m just curious about the api security in rails. I just want to ask if there is like a laravel passport in rails?

For those who does not know about Laravel Passport, I have a brief description below:

APIs typically use tokens to authenticate users and do not maintain session state between requests. Laravel makes API authentication a breeze using Laravel Passport, which provides a full OAuth2 server implementation for your Laravel application in a matter of minutes. Passport is built on top of the League OAuth2 server that is maintained by Andy Millington and Simon Hamp.

Here is my rails login codes, does the session[:user_id] is enough to authenticate and to check authenticated user?

user = User.find_by(email: params[:email])

if user && user.authenticate(params[:password])
  session[:user_id] =
  render json: { code: 200, data: user }, status: :ok

Source: Laravel

Leave a Reply