我需要传递api_client.request_jwt_user_token() API中的private_key_bytes:RSA私钥的字节内容。如何将RSA私钥转换为字节数组?
我假设您正在使用Python并使用我们的SDK。这是从GitHub上的code examples中摘录的代码段:(此行完成-private_key = cls._get_private_key().encode("ascii").decode("utf-8")
def _jwt_auth(cls): “”“ JSON Web令牌授权”“” api_client = ApiClient() api_client.set_base_path(DS_JWT [“ authorization_server”])
# Catch IO error
try:
private_key = cls._get_private_key().encode("ascii").decode("utf-8")
except (OSError, IOError) as err:
return render_template(
"error.html",
err=err
)
try:
cls.ds_app = api_client.request_jwt_user_token(
client_id=DS_JWT["ds_client_id"],
user_id=DS_JWT["ds_impersonated_user_id"],
oauth_host_name=DS_JWT["authorization_server"],
private_key_bytes=private_key,
expires_in=3600
)