How to skip Devise authentication when using an API key?

前端 未结 4 994
慢半拍i
慢半拍i 2020-12-28 10:04

I\'m using Devise on my application and would like to create a global API key that can access JSON data of anyone\'s account without having to log-in.

For example, s

4条回答
  •  既然无缘
    2020-12-28 10:49

    One option no one has mentioned is to have a completely separate set of controllers for the API that do not inherit from ApplicationController.

    I have seen the pattern used where API controllers live in files such as /app/controllers/api/v1/somethings.rb and are accessible via routes such as /api/v1/somethings. Each of the specific API controllers inherits from a base API controller that inherits from ActionController::Base, so does not include any of the filters defined on ApplicationController.

提交回复
热议问题