dimanche 29 janvier 2017

devise_token_auth credentials are expiring prematurely

I am using devise_token_auth for user authentication. My client credentials are expiring prematurely(like 3,5 minutes) and i couldn't find the heck why it is so.

Devise config files

initializers/devise_token_auth.rb

DeviseTokenAuth.setup do |config|
  config.change_headers_on_each_request = true         
  config.token_lifespan = 24.hours      
  config.default_confirm_success_url = "http://localhost:4000"
end

initializers/devise.rb

Devise.setup do |config|
  config.mailer_sender = "support@theinnerhour.com"
  config.navigational_formats = [:json]

end

models/user.rb

class User < ActiveRecord::Base     
    devise :database_authenticatable, :registerable,
    :recoverable, :rememberable, :trackable, :validatable, :omniauthable, :omniauth_providers => [:google_oauth2,:facebook] 
    include DeviseTokenAuth::Concerns::User
end

I confirmed expiry header set to after 24 hours after authenticating the user, but still they expire after 3-5 minutes and subsequent api calls give invalid credentials error.

Thanks

Aucun commentaire:

Enregistrer un commentaire