title: TypeError: 'str' object is not callable using flask-login when calling login_user(user)
body: <p>I am new to flask and was wondering why I keep getting a TypeError when calling login_user(user) even though a str variable/function was never defined in my code anywhere.</p>
  <pre><code>@app.route('/login', methods=['POST'])
  def login_post():
    user = User()
    username = request.form.get('username')
    password = request.form.get('password')
    if user.get_username != username or user.get_password != password:
      flash('Please check your login details and try again.')
      return redirect(url_for('login')) 
    else:
      login_user(user)
    return redirect(url_for('success'))
  </code></pre>
  <p>Here is my models.py:</p>
  <pre><code>import os
  from flask_login import UserMixin
  
  
  class User(UserMixin):
      def __init__(self):
          self._id = os.getenv(&quot;SECRET_ID&quot;)
          self._username = os.getenv(&quot;SECRET_KEY&quot;)
          self._password = os.getenv(&quot;SECRET_PASS&quot;)
  
      @property
      def get_username(self):
          return self._username
  
      @property
      def get_password(self):
          return self._password
  
      @property
      def get_id(self):
          return self._id
  
      @property
      def is_authenticated(self):
          return self.is_active()
  
      @property
      def is_anonymous(self):
          return False
  
      @property
      def is_active(self):
          return True
  </code></pre>
  <p>Here is the error message:</p>
  <pre><code>[2022-05-12 02:48:06,469] ERROR in app: Exception on /login [POST]
  Traceback (most recent call last):
    File &quot;/opt/virtualenvs/python3/lib/python3.8/site-packages/flask/app.py&quot;, line 2447, in wsgi_app
      response = self.full_dispatch_request()
    File &quot;/opt/virtualenvs/python3/lib/python3.8/site-packages/flask/app.py&quot;, line 1952, in full_dispatch_request
      rv = self.handle_user_exception(e)
    File &quot;/opt/virtualenvs/python3/lib/python3.8/site-packages/flask/app.py&quot;, line 1821, in handle_user_exception
      reraise(exc_type, exc_value, tb)
    File &quot;/opt/virtualenvs/python3/lib/python3.8/site-packages/flask/_compat.py&quot;, line 39, in reraise
      raise value
    File &quot;/opt/virtualenvs/python3/lib/python3.8/site-packages/flask/app.py&quot;, line 1950, in full_dispatch_request
      rv = self.dispatch_request()
    File &quot;/opt/virtualenvs/python3/lib/python3.8/site-packages/flask/app.py&quot;, line 1936, in dispatch_request
      return self.view_functions[rule.endpoint](**req.view_args)
    File &quot;main.py&quot;, line 42, in login_post
      login_user(user)
    File &quot;/opt/virtualenvs/python3/lib/python3.8/site-packages/flask_login/utils.py&quot;, line 196, in login_user
      user_id = getattr(user, current_app.login_manager.id_attribute)()
  TypeError: 'str' object is not callable
  </code></pre>
  <p>Any help to solve this would be greatly appreciated!</p>