change line: user {user, roles} must be passed to method, not only user
user = jwt.decode(data['jwt'], SECRET, algorithms=['HS256'])['user']
user = jwt.decode(data['jwt'], SECRET, algorithms=['HS256'])
user = jwt.decode(data['jwt'], SECRET, algorithms=['HS256'])['user']
user = jwt.decode(data['jwt'], SECRET, algorithms=['HS256'])