app/controllers/application_controller.rb
def authenticate_with_auth_token(auth_token)
    unless auth_token.include?(':')
      authentication_error
      return
    end

    user_id = auth_token.split(':').first
    user = User.where(id: user_id).first

    if user && Devise.secure_compare(user.access_token, auth_token)
      # User can access
      sign_in user, store: false
    else
      authentication_error
    end
  end
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
# protect_from_forgery with: :exception
Prevent CSRF attacks by raising an exception.
For APIs, you may want to use :null_session instead.
Prevent CSRF attacks by raising an exception . For APIs you may want to use : null_session instead .
def authenticate_with_auth_token(auth_token)
    unless auth_token.include?(':')
      authentication_error
      return
    end
    user_id = auth_token.split(':').first
    user = User.where(id: user_id).first
    if user && Devise.secure_compare(user.access_token, auth_token)
      sign_in user, store: false
    else
      authentication_error
    end
  end
def authenticate_with_auth_token ( auth_token ) unless auth_token . include? ( ':' ) authentication_error return end user_id = auth_token . split ( ':' ) . first user = User . where ( id : user_id ) . first if user && Devise . secure_compare ( user . access_token , auth_token ) sign_in user , store : false else authentication_error end end
Prevent CSRF attacks by raising an exception.
Prevent CSRF attacks by raising an exception .
# User can access
auth_token