How to skip Devise authentication when using an API key?

前端 未结 4 1002
慢半拍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:43

    I know its been a while since this was asked, but thought I would throw in one more option that i've used in the past

    class Api::ApplicationController < ApplicationController
    
    skip_before_filter :authenticate_user!
    

    This assumes that you have an application controller in your API directory that all of your api controllers inherit from. If not, you can just put the skip in each controller.

提交回复
热议问题