Repository is archived
No commit activity in last 3 years
No release in over 3 years
Patches Devise's token authentication strategy to add header-based token authentication to params/basic auth.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 0
 Project Readme

devise_token_auth_headers

Patches in support for token authentication via headers in addition to the basic auth or request params for Devise's token_authenticatable strategy.

Based on https://github.com/stvp/devise_header_token - if you need to replace params/basic auth support with headers, so token in parameters or in basic auth will not work, use it.

Usage

In your Gemfile:

gem 'devise'
gem 'devise_token_auth_headers'

In your config/initializers/devise.rb, set the authentication key as usual (or use default).

Now you can put your token in your headers. Gem generates two keys to check in headers: source key as is was, X-{source_key.upcase} and X-{source_key.camelize}. Of course it changes '-' to '_' and uses uppercase.

For example, if you use deault key @:auth_token@ then the header keys could be either "AUTH_TOKEN", "X_AUTH_TOKEN" or "X-AuthToken".

And it all should Just Work™.