This commit is contained in:
2025-07-18 11:42:06 +00:00
parent f530fa639a
commit 4ec2e46c4b
5 changed files with 70 additions and 23 deletions

View File

@@ -114,13 +114,22 @@ export class BunqAccount {
throw new Error('Creating sandbox users only works in sandbox environment');
}
const response = await this.apiContext.getHttpClient().post(
'/v1/sandbox-user-person',
{}
// Sandbox user creation doesn't require authentication
const response = await plugins.smartrequest.request(
'https://public-api.sandbox.bunq.com/v1/sandbox-user-person',
{
method: 'POST',
headers: {
'Content-Type': 'application/json',
'User-Agent': 'bunq-api-client/1.0.0',
'Cache-Control': 'no-cache'
},
requestBody: '{}'
}
);
if (response.Response && response.Response[0] && response.Response[0].ApiKey) {
return response.Response[0].ApiKey.api_key;
if (response.body.Response && response.body.Response[0] && response.body.Response[0].ApiKey) {
return response.body.Response[0].ApiKey.api_key;
}
throw new Error('Failed to create sandbox user');