如何配置设计接受HTTP头中的身份验证令牌?

ohh*_*hho 7 ruby-on-rails devise ruby-on-rails-3

目前,设计配置为通过URL接受令牌认证,并且curl运行良好

curl 'http://localhost/index.json?auth_token=TOKENVALUE'
Run Code Online (Sandbox Code Playgroud)

现在我想通过通过HTTP标头,而不是URL的TOKENVALUE,我该怎么配置设计获得从TOKENVALUE 或者 HTTP标头 URL?这样上面和下面的curl请求都可以工作:

curl 'http://localhost/index.json' -H 'Authorization: Token token="TOKENVALUE"'
Run Code Online (Sandbox Code Playgroud)

如此railscast中所示.

小智 1

设备中好像没有这样的配置。但其他人有一个解决方案。请参阅在 Rails 3 / devise 中使用请求标头中的 auth_token 而不是 POST/PUT 参数