-
-
Notifications
You must be signed in to change notification settings - Fork 232
Open
Labels
Description
After successful authentication, What is the type of g.flask_httpauth_user that is added by the @login_required decorator?
I expect to find user object, But As I can understand from the source code, It is always str or None. In the case of string it will be the username.
If my note is true, It will is better to change this behavior to store user object. If this will break the backword compatibility, I suggest to add optional user loader callback, that will be called after successful login.
The current behavior break the example mentioned :
`@bp.route('/tokens', methods=['POST'])
@basic_auth.login_required
def get_token():
token = basic_auth.current_user().get_token()
db.session.commit()
return jsonify({'token': token})`
basic_auth.current_user() return the g.flask_httpauth_user which has no method named get_token()
Thank you.
Version: 4.4.0