title: Which Timed JSONWebSignature Serializer replacement for itsdangerous is better? pyjwt or authlib
body: <p>Currently I was using <code>itsdangerous</code> to generate timed json web signature as a token for users to auth and resetpassword etc. Here's the code:</p>
  <pre><code>from itsdangerous import TimedJSONWebSignatureSerializer as Serializer
  
  class SampleCode:
      def generate_confirmation_token(self, expiration=600):
          s = Serializer(current_app.config['SECRET_KEY'], expires_in=expiration)
          return s.dumps({'confirm': self.id}).decode('utf-8')
  
      def confirm(self, token):
          s = Serializer(current_app.config['SECRET_KEY'])
          try:
              data = s.loads(token.encode('utf-8'))
          except:
              return False
          if data.get('confirm') != self.id:
              return False
          self.confirmed = True
          db.session.add(self)
          return True
  </code></pre>
  <p>And since <code>TimedJSONWebSignatureSerializer</code> is <a href="https://github.com/pallets/itsdangerous/blob/d1c85670cce70d81f9949619434daf8c0b9cd37e/src/itsdangerous/jws.py#L23-L30" rel="noreferrer">deprecated</a> and removed in <code>itsdangerous</code> <code>2.1.0</code> I think I might need to move on to some other libs that provides a JWT/JWS interface.</p>
  <p>And here I've got two candidates, which one is better:</p>
  <ul>
  <li><a href="https://pyjwt.readthedocs.io/en/stable/" rel="noreferrer">pyjwt</a></li>
  <li><a href="https://docs.authlib.org/en/latest/index.html" rel="noreferrer">authlib</a></li>
  </ul>