Closed sankarcn closed 6 years ago
I take it you created the api key via tinker ? (The sandbox_ prefix) the the environment should indeed be sandbox. The prefix should also not be removed.
This is not an sdk error rather an api error.
This error happens when:
Op 3 sep. 2018 om 07:19 heeft sankarcn notifications@github.com het volgende geschreven:
Steps to reproduce:
1.Created an API Key using https://public-api.sandbox.bunq.com/v1/sandbox-user
- Then tried to create an installation context using below PHP code. require_once DIR . '/vendor/autoload.php'; use bunq\Context\ApiContext; use bunq\Util\BunqEnumApiEnvironmentType;
$environmentType = BunqEnumApiEnvironmentType::SANDBOX(); // Can also be BunqEnumApiEnvironmentType::PRODUCTION(); $apiKey = 'XXXXXXXXX'; // Replace with your API key $deviceDescription = 'Testing of BUNQ'; // Replace with your device description $permittedIps = ['0.0.0.0']; // List the real expected IPs of this device or leave empty to use the current IP
$apiContext = ApiContext::create( $environmentType, $apiKey, $deviceDescription, $permittedIps );
BunqContext::loadApiContext($apiContext); $fileName = 'bunq.cfg'; // Replace with your own secure location to store the API context details $apiContext->save($fileName);
What should happen:
bunq.cfg file should get created. What happens:
I got error with both by keeping the API Key recieved AS IS and also removing the "sandbox_" prefix of the api key. Traceback
Fatal error: Uncaught bunq\Exception\BadRequestException: HTTP Response Code: 400 The response id to help bunq debug: 97537c35-c215-4e5d-b7da-ae1718e3ec91 Error message: User credentials are incorrect. Incorrect API key or IP address. in C:\xampp\htdocs\vendor\bunq\sdk_php\src\Exception\ExceptionFactory.php:52 Stack trace: #0 C:\xampp\htdocs\vendor\bunq\sdk_php\src\Http\Handler\ResponseHandlerError.php(54): bunq\Exception\ExceptionFactory::createExceptionForResponse(Array, 400, '97537c35-c215-4...') #1 C:\xampp\htdocs\vendor\bunq\sdk_php\src\Http\Handler\HandlerUtil.php(42): bunq\Http\Handler\ResponseHandlerError->execute(Object(GuzzleHttp\Psr7\Response)) #2 C:\xampp\htdocs\vendor\guzzlehttp\promises\src\FulfilledPromise.php(39): bunq\Http\Handler\HandlerUtil::bunq\Http\Handler{closure}(Object(GuzzleHttp\Psr7\Response)) #3 C:\xampp\htdocs\vendor\guzzlehttp\promises\src\TaskQueue.php(47): GuzzleHttp\Promise\FulfilledPromise::GuzzleHttp\Promise{closure}() #4 C:\xampp\htdocs\vendor\guzzlehttp\promises\src\Promise.php(246): in C:\xampp\htdocs\vendor\bunq\sdk_php\src\Exception\ExceptionFactory.php on line 52
SDK version and environment
Tested on Latest version of GITHUB Sandbox Response id
Response id:abd746a1-fccc-478f-a594-3127c3ab77f1 (When using "sandbox" prefix of api key Response id:97537c35-c215-4e5d-b7da-ae1718e3ec91 (Without using "sandbox" prefix of api key Extra info:
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.
Steps to reproduce:
1.Created an API Key using https://public-api.sandbox.bunq.com/v1/sandbox-user
$environmentType = BunqEnumApiEnvironmentType::SANDBOX(); // Can also be BunqEnumApiEnvironmentType::PRODUCTION(); $apiKey = 'XXXXXXXXX'; // Replace with your API key $deviceDescription = 'Testing of BUNQ'; // Replace with your device description $permittedIps = ['0.0.0.0']; // List the real expected IPs of this device or leave empty to use the current IP
$apiContext = ApiContext::create( $environmentType, $apiKey, $deviceDescription, $permittedIps );
BunqContext::loadApiContext($apiContext); $fileName = 'bunq.cfg'; // Replace with your own secure location to store the API context details $apiContext->save($fileName);
What should happen:
What happens:
Traceback
Fatal error: Uncaught bunq\Exception\BadRequestException: HTTP Response Code: 400 The response id to help bunq debug: 97537c35-c215-4e5d-b7da-ae1718e3ec91 Error message: User credentials are incorrect. Incorrect API key or IP address. in C:\xampp\htdocs\vendor\bunq\sdk_php\src\Exception\ExceptionFactory.php:52 Stack trace: #0 C:\xampp\htdocs\vendor\bunq\sdk_php\src\Http\Handler\ResponseHandlerError.php(54): bunq\Exception\ExceptionFactory::createExceptionForResponse(Array, 400, '97537c35-c215-4...') #1 C:\xampp\htdocs\vendor\bunq\sdk_php\src\Http\Handler\HandlerUtil.php(42): bunq\Http\Handler\ResponseHandlerError->execute(Object(GuzzleHttp\Psr7\Response)) #2 C:\xampp\htdocs\vendor\guzzlehttp\promises\src\FulfilledPromise.php(39): bunq\Http\Handler\HandlerUtil::bunq\Http\Handler{closure}(Object(GuzzleHttp\Psr7\Response)) #3 C:\xampp\htdocs\vendor\guzzlehttp\promises\src\TaskQueue.php(47): GuzzleHttp\Promise\FulfilledPromise::GuzzleHttp\Promise{closure}() #4 C:\xampp\htdocs\vendor\guzzlehttp\promises\src\Promise.php(246): in C:\xampp\htdocs\vendor\bunq\sdk_php\src\Exception\ExceptionFactory.php on line 52
SDK version and environment
Response id
Extra info: