I have the following code:
from itsdangerous import URLSafeTimedSerializer as Serialiser
class User(db.Model, UserMixin):
def get_reset_token(self, expiration_sec=1800):
s = Serialiser(app.config['SECRET_KEY'], expiration_sec)
return s.dumps({'user_id': self.id})
When I try to execute this I get the following stack of errors:
rv = self.make_signer(salt).sign(payload)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\itsdangerous\timed.py", line 55, in sign
return value + sep + self.get_signature(value)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\itsdangerous\signer.py", line 209, in get_signature
key = self.derive_key()
^^^^^^^^^^^^^^^^^
File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\itsdangerous\signer.py", line 195, in derive_key
bytes, self.digest_method(bytes(self.salt) + b"signer" + secret_key).digest()
^^^^^^^^^^^^^^^^^^^^^
TypeError: unsupported operand type(s) for +: 'int' and 'bytes'
I am not really sure what the problem is here as I am quite new to this new module and using in flask applications