LoginSignup
0
0

More than 3 years have passed since last update.

Rails API modeでBasicAuthを入れる方法

Posted at

RailsのAPI modeでは、いくつかの機能が使えない。フロントを用意しないのでSessionなどが使えない状態になっていて、Deviseを入れる際に苦労する。

今回、Basic認証をいれようとしたら同じく苦労したので調べた。
結果は次の一行をBasic認証入れたいControllerで呼ぶだけ。

include ActionController::HttpAuthentication::Basic::ControllerMethods
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0