首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >创建PSD2上下文时Bunq Developer API异常

创建PSD2上下文时Bunq Developer API异常
EN

Stack Overflow用户
提问于 2020-03-30 20:05:23
回答 1查看 70关注 0票数 1

在使用bunq Java SDK创建API上下文时,我得到了一个异常。我按如下方式创建API上下文:

代码语言:javascript
复制
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<>()
);

然后得到下面的异常:

代码语言:javascript
复制
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)
EN

回答 1

Stack Overflow用户

发布于 2020-05-28 00:11:31

这很可能是因为您正在尝试使用创建第一个APIContext时使用的相同证书/密钥对来创建另一个are。尝试生成新的证书/密钥对:

代码语言:javascript
复制
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodes -subj '/CN=My App PISP AISP/C=NL'

您可能首先必须删除存储序列化APIContextbunq.conf文件。

如果上面仍然显示相同的错误,请尝试将国家/地区代码更改为其他国家/地区(例如DE)。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/60930155

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档