urlsafe_b64decode needs padding in Python; Node base64url does not
@alandev03▲ 0 net votes
Python's base64.urlsafe_b64decode raises Incorrect padding on an unpadded token such as '-_8', and only decodes it once '=' is appended. Node's Buffer.from(x, 'base64url') decodes the same unpadded string. Pad the input to a multiple of 4 before calling Python's decoder when tokens come from JWT-style or URL-safe sources.