rails + devise + devise_token_auth

model/cuustomer.rb


  devise :database_authenticatable, :registerable,
         :recoverable, :rememberable, :validatable, :confirmable,
         :omniauthable
  include DeviseTokenAuth::Concerns::User
  
  serialize :tokens

  after_create :send_confirmation_email, if: -> { !Rails.env.test? && Customer.devise_modules.include?(:confirmable) }
  private
    def send_confirmation_email
      self.send_confirmation_instructions
    end

end

Thanks to this serialize: tokens, I couldn't even try to log in with Postman. Thank you very much.

model/cuustomer.rb


  devise :database_authenticatable, :registerable,
         :recoverable, :rememberable, :validatable, :confirmable,
         :omniauthable
  include DeviseTokenAuth::Concerns::User
  
  # serialize :tokens

  after_create :send_confirmation_email, if: -> { !Rails.env.test? && Customer.devise_modules.include?(:confirmable) }
  private
    def send_confirmation_email
      self.send_confirmation_instructions
    end

end

devise_token_auth # When you forget your password

スクリーンショット 2020-12-25 8.24.11.png

devise_token_auth # login

スクリーンショット 2020-12-25 8.25.06.png

Recommended Posts

rails + devise + devise_token_auth
[Rails] devise
[Rails] Introducing devise
Handle devise with Rails
[Rails] devise introduction method
[rails] About devise defaults
What is Rails gem devise?
[Rails] gem devise installation flow
[Rails] How to install devise
(For beginners) [Rails] Install Devise
[Rails] Add column to devise
[Rails] Initial setting of user-created login with devise, devise_token_auth
[rails] error during devise installation
Memorandum [Rails] User authentication Devise
[Rails] How to use gem "devise"
[Rails] How to use devise (Note)
[Rails] Session timeout setting in devise
[rails] Login screen implementation in devise
[Devise] rails memo basic setting initial setting
[Rails] [Devise] Edit profile without password
Ruby On Rails devise routing conflict
[Rails] Add strong parameters to devise
Create My Page with Rails devise
[Rails] Manage multiple models using devise gem
[Rails g.error]
Introducing devise
Rails basics
Rails Review 1
[Rails] Function restrictions in devise (login / logout)
Rails API
Rails migration
[Rails] first_or_initialize
rails tutorial
Rails foundation
Rails g devise: install cannot be executed!
Rails memorandum
rails tutorial
rails tutorial
rails tutorial
About devise
Devise procedure
[Note] How to use Rails 6 Devise + cancancan
Introducing devise
rails tutorial
rails tutorial
Rails Tips
rails method
rails tutorial
[Rails] How to translate devise into Japanese
[Rails] ActiveRecord
[Rails] form_with
Rails Review 2
Create authentication function in Rails application using devise
The road to Japaneseizing Rails devise error messages
Rails: Japanese localization of validation messages including devise
[Nuxt / Rails] POST implementation using axios and devise_token_auth
[Note] Summary of rails login function using devise ①
[Rails] Added in devise: username not added to database