app/models/devise_token_auth/concerns/user.rb
# update user's auth token (should happen on each request)
update user's auth token (should happen on each request)
update user ' s auth token ( should happen on each request )
def create_new_auth_token(client_id=nil)
    client_id  ||= SecureRandom.urlsafe_base64(nil, false)
    last_token ||= nil
    token        = SecureRandom.urlsafe_base64(nil, false)
    token_hash   = BCrypt::Password.create(token)
    expiry       = (Time.now + DeviseTokenAuth.token_lifespan).to_i
    if self.tokens[client_id] and self.tokens[client_id]['token']
      last_token = self.tokens[client_id]['token']
    end
    self.tokens[client_id] = {
      token:      token_hash,
      expiry:     expiry,
      last_token: last_token,
      updated_at: Time.now
    }
    self.save!
    return build_auth_header(token, client_id)
  end
def create_new_auth_token ( client_id = nil ) client_id ||= SecureRandom . urlsafe_base64 ( nil , false ) last_token ||= nil token = SecureRandom . urlsafe_base64 ( nil , false ) token_hash = BCrypt :: Password . create ( token ) expiry = ( Time . now + DeviseTokenAuth . token_lifespan ) . to_i if self . tokens [ client_id ] and self . tokens [ client_id ] [ 'token' ] last_token = self . tokens [ client_id ] [ 'token' ] end self . tokens [ client_id ] = { token : token_hash , expiry : expiry , last_token : last_token , updated_at : Time . now } self . save! return build_auth_header ( token , client_id ) end
update user's auth token (should happen on each request)
update user ' s auth token ( should happen on each request )
client_id
<not_specific>