尝试示例项目:https://github.com/docusign/eg-01-java-jwt
出现以下错误:
Fetching an access token via JWT grant...
Exception in thread "main" com.docusign.esign.client.ApiException: Error while requesting an access token: POST https://account-d.docusign.com/oauth/token returned a response status of 400 Bad Request
at com.docusign.esign.client.ApiClient.requestJWTUserToken(ApiClient.java:740)
我猜我在组装 JWT 请求时错过了一些东西:
String privateKey = DSConfig.PRIVATE_KEY.replace("\\n", "\n");
byte[] privateKeyBytes = privateKey.getBytes();
apiClient.setOAuthBasePath(DSConfig.DS_AUTH_SERVER);
OAuth.OAuthToken oAuthToken = apiClient.requestJWTUserToken(
DSConfig.CLIENT_ID,
DSConfig.IMPERSONATED_USER_GUID,
scopes,
privateKeyBytes,
TOKEN_EXPIRATION_IN_SECONDS);
配置属性:
# Integrator Key (client id) iss
DS_CLIENT_ID=4dcfdaa1-xxxx-xxxx-xxxx-110bf207310f
# API username Guid sub
DS_IMPERSONATED_USER_GUID=5aff04e4-xxxx-xxxx-xxxx-7ac9eefdac1a
# private key string
DS_PRIVATE_KEY=\n\
-----BEGIN RSA PRIVATE KEY-----\n\
MIIEowIBAAKCAQEAgb2XJwtQ3S8henWphAtUcAChdDl1yYzHllytR4DZMY5hqp6E\n\
8A2kxblecKHSa4OMn5fP2liyWOCNNA7Vactj0/zI60yUdeOtRg4GyjjG/ShPc80F\n\
...
sJn5DNlHlwpQjsxyVpxrkGNIRzhTUxdBGZ4VZrh5QM77z9kSX9uKkZ7oZQWv7IcJ\n\
hO80HJ6v12HvTqypoqqOvVPKC1SK61cwdWdKi1GExcPqbrFoAJkB\n\
-----END RSA PRIVATE KEY-----
我得到的唯一错误是:
Exception in thread "main" com.docusign.esign.client.ApiException: Error while requesting an access token: POST https://account-d.docusign.com/oauth/token returned a response status of 400 Bad Request
想知道为什么它在 400 时失败,并且没有其他信息可以用来弄清楚为什么我得到 400。
我打赌你们可能知道为什么会发生这种情况。提前致谢。
倚天杖
撒科打诨
Smart猫小萌
相关分类