bunq / sdk_php

PHP SDK for bunq API
MIT License
84 stars 54 forks source link

SDK not working on Windows (XAMPP) #8

Closed BabyDino closed 7 years ago

BabyDino commented 7 years ago

When using XAMPP on a local windows development machine I get the following error:

Error: An unexpected error occurred with status code "400" and message "The request signature is invalid."

Code used:

$environmentType = BunqEnumApiEnvironmentType::SANDBOX();
$apiKey = '### Your API Key ###';
$deviceDescription = '### Your device description ###';
$permittedIps = ['my.local.ip.address'];

$apiContext = ApiContext::create(
    $environmentType,
    $apiKey,
    $deviceDescription,
    $permittedIps
);

This does not happen on Linux machines. It seems to be a problem with the session-server call, the first call that has to be signed.

dnl-blkv commented 7 years ago

@BabyDino It is most probably related to the line endings! Thank you for pointing out, I'll fix it and roll out hopefully today :)

BabyDino commented 7 years ago

Most probably yes, I had the same issue with my own wrapper now you mention it.

Do not rely on PHP_EOL when signing. bunq expects \n.

dnl-blkv commented 7 years ago

Fixed by @BabyDino :)