Ruby on rails 多标头标记Rails

Ruby on rails 多标头标记Rails,ruby-on-rails,http,Ruby On Rails,Http,在我的API中,我有一个用于限制访问的before\u过滤器 def restrict_access authenticate_or_request_with_http_token do |token, options| ApiKey.exists?(access_token: token) end end 在标题中放置一个标记(来自php wordpres

在我的API中,我有一个用于限制访问的before\u过滤器

        def restrict_access
            authenticate_or_request_with_http_token do |token, options|
                ApiKey.exists?(access_token: token)
            end             
        end
在标题中放置一个标记(来自php wordpress插件)


我可以向标头发送多个令牌吗?就像他们正在访问的模型的访问令牌和请求它的人的身份令牌一样?如果是这样的话,您如何让它检查两个不同的令牌?

您可以制作一个大令牌来保存所有信息,然后在rails应用程序中剪切它并获得所需的信息

或者,您可以通过以下方式手动获取令牌:

def authenticate
  token = request.headers['custom-auth-token']
  ApiKey.exists?(access_token: token)
end
def authenticate
  token = request.headers['custom-auth-token']
  ApiKey.exists?(access_token: token)
end