title: Is it possible to use Flask-Login's authentication as simple HTTP auth for a REST API?
body: <p>Right now, my webapp has a full auth system implemented through Flask-Login. But say that I have this controller:</p>
  
  <pre><code>@app.route("/search_query")
  @login_required
  def search_query():
      query = request.args.get("query")
      return jsonify(search(query))
  </code></pre>
  
  <p>This works great when you login to the page and make searches against it, if you're authenticated it goes through, otherwise it routes you back to the login page (through an unauthorized_handler function). </p>
  
  <pre><code>@lm.unauthorized_handler
  def unauthorized():
      return redirect(url_for("login"))
  </code></pre>
  
  <p>The problem is, I want to be able to use some form of simple HTTP authentication for this without having two separate auth systems so that I can make REST API calls against it. In short, I want to avoid having to use both Flask-Login and HTTPBasicAuth, and just use Flask-Login to achieve simple authentication, is this possible through Flask-Login?</p>