def generate_auth_token(self, expiration = 3600): s = Serializer(app.config['SECRET_KEY'], expires_in = expiration) str = s.dumps({'id': self.id}) return b64encode(str).decode('utf-8')