This gem provides the extracted Token Authenticatable module of devise. It enables the user to sign in via an authentication token. Th
This gem provides the extracted Token Authenticatable module of devise. It enables the user to sign in via an authentication token. Th
This gem provides the extracted Token Authenticatable module of devise. It includes the functionality that was also in version 3.1.2 of devise. With the inclusion of this module a user is able to sign in via an authentication token. This token can be given via a query string or HTTP Basic Authentication. See the hint below to understand which version of this gem supports which version of devise.
Use this gem as a starting point for your own token authentication mechanism for devise. Furthermore, if you need token authentication in connection with newer devise releases this gem might be an appropriate solution, too.
Add this line to your application's Gemfile:
gem 'devise-token_authenticatable'And then execute:
$ bundleOr install it yourself as:
$ gem install devise-token_authenticatable| devise-token_authenticatable | devise |
|---|---|
~> 0.1 |
~> 3.2.0 |
~> 0.2 |
~> 3.3.0 |
~> 0.3 |
~> 3.4.0 |
~> 0.4.0, 3.5.0, 0.4.9 |
~> 3.5.2 |
~> 0.5.x, = 4.0.0, 1.1.0 |
>= 4.0.0, < 5.0.0 |
Create needed columns with corresponding migration:
def change
add_column :users, :authentication_token, :text
add_column :users, :authentication_token_created_at, :datetime
add_index :users, :authentication_token, unique: true
endAdd :token_authenticatable to your devise model:
class User < ActiveRecord::Base
devise :database_authenticatable, :token_authenticatable
endThis gem can be configured as shown in the following:
…Enable devise's HTTP Auth for the token strategy as shown below:
# initializers/devise.rb
Devise.setup do |config|
# ...
config.http_authenticatable = true
# or
config.http_authenticatable = [:token]
# ...
endAdd :token_auth to your devise configuration:
Devise.setup do |config|
config.skip_session_storage = [:http_auth, :token_auth]
endFor your convenience there is also a source code documentation.
git checkout -b my-new-feature).git commit -am 'Add some feature').git push origin my-new-feature).No open issues yet, or sync has not completed.