Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ def _get_arrow_lib_as_linker_input(self):
'pyOpenSSL>=16.2.0,<20.0.0',
'cffi>=1.9,<2.0.0',
'cryptography>=2.5.0,<4.0.0',
'pyjwt<2.0.0',
'pyjwt<3.0.0',
'oscrypto<2.0.0',
'asn1crypto>0.24.0,<2.0.0',
# A functioning pkg_resources.working_set.by_key and pkg_resources.Requirement is
Expand Down
14 changes: 12 additions & 2 deletions src/snowflake/connector/auth_keypair.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,18 @@ def authenticate(
self.EXPIRE_TIME: self._jwt_token_exp
}

self._jwt_token = jwt.encode(payload, private_key,
algorithm=self.ALGORITHM).decode('utf-8')
_jwt_token = jwt.encode(
payload,
private_key,
algorithm=self.ALGORITHM
)

# jwt.encode() returns bytes in pyjwt 1.x and a string
# in pyjwt 2.x
if isinstance(_jwt_token, bytes):
self._jwt_token = _jwt_token.decode('utf-8')
else:
self._jwt_token = _jwt_token

return self._jwt_token

Expand Down