question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

v2.0.0 breaking changes jwt.encode()

See original GitHub issue

Expected Result

jwt.encode() to return an object with a decode property.

Actual Result

E       AttributeError: 'str' object has no attribute 'decode'**

Reproduction Steps

import jwt
from datetime import datetime

secret, algorithm = 'secret', 'hs256'
now = int(datetime.now().timestamp())
payload = {'sub': 'Expiry Test', 'iat': now, 'exp': now + 2}

token = jwt.encode(payload, secret, algorithm=algorithm.upper()).decode()

System Information

$ python -m jwt.help
{
  "cryptography": {
    "version": "2.8"
  },
  "implementation": {
    "name": "CPython",
    "version": "3.8.6"
  },
  "platform": {
    "release": "19.6.0",
    "system": "Darwin"
  },
  "pyjwt": {
    "version": "2.0.0"
  }
}
        

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
arberxcommented, Dec 23, 2020

For backwards compatibility, decode() should be a method on the class, and simply call .decode_complete().

In its current form in v2.0.0, this is a significant change to this interface and will break a lot of projects.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Changelog — PyJWT 2.6.0 documentation
All notable changes to this project will be documented in this file. ... signing as per RFC7517 #668; Prefer headers[“alg”] to algorithm in...
Read more >
ruby-jwt/CHANGELOG.md at main - GitHub
A ruby implementation of the RFC 7519 OAuth JSON Web Token (JWT) standard. ... Change from 1.5.6 to 2.0.0 and appears a "Completed...
Read more >
Changelog - hapi.dev
use utf-8 encoding, closes #21 ... Load the JWT from an arbitrary location in the request ... 2.0.0. breaking changes. #11. Require hapi...
Read more >
PyJWT - Release 2.6.0 - Read the Docs
4.2.2 Encoding & Decoding Tokens with RS256 (RSA) ... Expiration time is automatically verified in jwt.decode() and raises jwt.
Read more >
Firebase JavaScript SDK Release Notes - Google
Changed the networking API to use XHR instead of fetch() for React Native. ... Fixed JWT encoding bug that broke interoperability with the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found