Skip to content Skip to sidebar Skip to footer

Security_password_salt Must Not Be None - Flask Security

This question is related to: Unique Salt per User using Flask-Security, but I'm more concerned with removing this error message. The linked question established that flask-security

Solution 1:

The global "salt" you specify in SECURITY_PASSWORD_SALT is combined with the unique salt generated for each password that gets created. That combined value is then used to salt the password when it gets hashed. So yes, you do need to set this, it's not a spurious error.

(Others have noted that it's quite confusing to refer to this as a salt, when that strongly implies that the value in this variable is going to be used to salt the password for every user. Fortunately, that's not what happens.)

Here are some options for generating a random string.

Solution 2:

Usually the SECRET_KEY value is set in a Flask app. A simple solution to the error with Flask-Security is add this line to your Flask application:

if'SECURITY_PASSWORD_SALT'notin app.config:
    app.config['SECURITY_PASSWORD_SALT'] = app.config['SECRET_KEY']

Post a Comment for "Security_password_salt Must Not Be None - Flask Security"