I was doing my User model by inheriting UserMixin from flask-login, an exception was raised:
This is because I implemented my own “userid” by replacing the default “id” attribute in UserMixin, so for id columns just use the default “id” and not implement any attribute according to your wish if you want to use UserMixin to be part of your User model class.
Previously was “userid”, so I changed to “id” to match the attribute returned by UserMixin.
See documentation on method get_id. Also see this stackoverflow explanation.