我试图获取访问令牌以通过JWT授予方法访问DocuSign Monitor API,如DocuSign Monitor API文档中所述。这是我的测试脚本的片段:
def create_jwt(self):
epoch_time = int(time.time())
priv_key = self.get_rsa(self.privkey_path)
pub_key = self.get_rsa(self.pubkey_path)
body = {"iss": self.iss,
"iat": epoch_time,
"exp": (epoch_time + 3000),
"aud": 'account-d.docusign.com',
"scope": "monitor"}
encoded = jwt.encode(body, priv_key, algorithm='RS256')
# decoded = jwt.decode(encoded, pub_key, audience='account-d.docusign.com', algorithm='RS256')
return encoded
def request_access_token(self, encoded_token):
url = 'https://account-d.docusign.com/oauth/token'
data = {'grant_type': 'urn:ietf:params:oauth:grant-type:jwt-bearer',
'assertion': encoded_token}
response = requests.post(url=url, data=data)
return response.text
request_access_token返回:
{"error":"invalid_scope"}
据我所知,我正确地遵循了文档。使用这些功能,我能够成功为其他范围(例如签名等)生成访问令牌。由于开发人员帐户是beta功能,因此请求访问监视器范围是否存在一些问题?对“ lens.docusign.net/api/v1.0/monitor/organization/{{organizationId}}”的有效请求是什么样的?我假设有人在尝试向监视器API发出请求之前需要获取访问令牌?我不知道我要去哪里错了。任何帮助将不胜感激。