在使用bunq Java SDK创建API上下文时,我得到了一个异常。我按如下方式创建API上下文:
ApiContext apiContext = ApiContext.createForPsd2(
ApiEnvironmentType.SANDBOX,
SecurityUtils.getCertificateFromFile("cert.pem"),
SecurityUtils.getPrivateKeyFromFile("key.pem"),
new Certificate[]{
SecurityUtils.getCertificateFromFile("cert.pem")
},
API_DEVICE_DESCRIPTION,
new ArrayList<>()
);然后得到下面的异常:
Exception in thread "main" com.bunq.sdk.exception.BadRequestException: Response id to help bunq debug: 12414de4-f961-4e52-9cfd-e6a53e602b1b.
Error message:
You can have at most 1 active server credentials.
at com.bunq.sdk.exception.ExceptionFactory.createExceptionForResponse(ExceptionFactory.java:40)
at com.bunq.sdk.http.ApiClient.createApiExceptionRequestUnsuccessful(ApiClient.java:326)
at com.bunq.sdk.http.ApiClient.assertResponseSuccess(ApiClient.java:307)
at com.bunq.sdk.http.ApiClient.createBunqResponseRaw(ApiClient.java:285)
at com.bunq.sdk.http.ApiClient.post(ApiClient.java:187)
at com.bunq.sdk.model.core.PaymentServiceProviderCredentialInternal.createWithApiContext(PaymentServiceProviderCredentialInternal.java:54)
at com.bunq.sdk.model.core.PaymentServiceProviderCredentialInternal.createWithApiContext(PaymentServiceProviderCredentialInternal.java:35)
at com.bunq.sdk.context.ApiContext.initializePsd2Credential(ApiContext.java:254)
at com.bunq.sdk.context.ApiContext.createForPsd2(ApiContext.java:159)
at io.heist.bunq.BunqData.context(BunqData.java:143)
at io.heist.bunq.BunqData.apiKeys(BunqData.java:115)
at io.heist.bunq.BunqData.main(BunqData.java:171)发布于 2020-05-28 00:11:31
这很可能是因为您正在尝试使用创建第一个APIContext时使用的相同证书/密钥对来创建另一个are。尝试生成新的证书/密钥对:
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodes -subj '/CN=My App PISP AISP/C=NL'您可能首先必须删除存储序列化APIContext的bunq.conf文件。
如果上面仍然显示相同的错误,请尝试将国家/地区代码更改为其他国家/地区(例如DE)。
https://stackoverflow.com/questions/60930155
复制相似问题