gpt4 book ai didi

java - 使用requestJWTUserToken时出错,只需替换我的帐户信息SDK项目,junit代码

转载 作者:行者123 更新时间:2023-11-30 01:56:47 30 4
gpt4 key购买 nike

我正在运行官方 SDK Junit 代码,并且运行良好。但是当我将帐户信息更改为我的帐户信息时,就会发生异常。调试表示,在发布到端点“/oauth/token”时,它返回 http 状态 400,

我已将 docusign 管理页面中生成的私钥保存到“docusign_private_key.txt”中

ApiClient apiClient = new ApiClient (BaseUrl);
//String currentDir = System.getProperty("user.dir");

try
{

// IMPORTANT NOTE:
// the first time you ask for a JWT access token, you should grant access by making the following call
// get DocuSign OAuth authorization url:
//String oauthLoginUrl = apiClient.getJWTUri(IntegratorKey, RedirectURI, OAuthBaseUrl);
// open DocuSign OAuth authorization url in the browser, login and grant access
//Desktop.getDesktop().browse(URI.create(oauthLoginUrl));
// END OF NOTE
byte[] privateKeyBytes = null;
try
{
privateKeyBytes = Files.readAllBytes (Paths.get (privateKeyFullPath) );
}
catch (IOException ioExcp)
{
Assert.assertEquals (null, ioExcp);
}
if (privateKeyBytes == null)
{
return;
}
java.util.List<String> scopes = new ArrayList<String>();
scopes.add (OAuth.Scope_SIGNATURE);
scopes.add (OAuth.Scope_IMPERSONATION);
OAuth.OAuthToken oAuthToken = apiClient.requestJWTUserToken (IntegratorKey, UserId, scopes, privateKeyBytes, 3600);
}

最佳答案

问题已解决。

SDK JUnit 代码定义了一个名为“UserId”的参数,它应该由“API 用户名”填写,而不是管理页面中的“API 帐户 ID”。

谢谢所有好心人。

关于java - 使用requestJWTUserToken时出错,只需替换我的帐户信息SDK项目,junit代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54177199/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com