Closed Ebioro closed 6 years ago
Working on this now, will notify you when I fix it
Great! I've got more info on the error today. It seems that the signature somehow is invalid. Please see below
{ Error: [ { error_description: 'The request signature is invalid.', error_description_translated: 'The request signature is invalid.' } ] } 400 { date: 'Wed, 20 Jun 2018 11:39:26 GMT', 'content-type': 'application/json', 'transfer-encoding': 'chunked', connection: 'close', server: 'Apache', 'x-bunq-client-response-id': 'c291d372-fdbe-4403-8fe5-110f6ba607c9', 'x-bunq-client-request-id': '1529494766424.862', 'x-bunq-server-signature': 'j/uw1qCoXSzcx3Gq+iOyiQND9iC9CPoj9Xu/fdymXskNB2l/r1shyn4eS0Yb3XcD3qzliLfoM8qUzN0ehnrw6mpwT+ZkdpdUcQ1RZm8rlkdkZeDcVDdsvQs5NstSGholepsLbJXZgrxYYc5iH/bnbgrGCD+Z2kHTmwLiw+smmHwyFdd6mYKKbdbr7Am7RqtecOp/SASQJbqT3F69Ck3QipAiNmLyLASxto113X2Z4ccSt/orWZqG03HzIAbMf3rfkqCSlGKmRmCCOHw1VYqoMWnysPmPkil/ewuEad5XG4/ym7or/AGZthu+WjCBVtYwZjsiRLX2cUvy+JAJ8nQAOQ==' }
I already fixed all the issues and I'll push a new version in a bit 👍
Oh man, amazing! Let me know once you push the new version
Should be up now with version 0.21.3 Thanks for reporting the issue
Description
Currently using the BunqJSClient with NodeJS. I have followed all the steps in the installation https://github.com/BunqCommunity/BunqJSClient#installation and everything runs fine until the registerSession() method. See below logs:
BunqJSClient run === Loading session data === Express server listening on port 4040 sessionId: 7776 installCreated: 2018-06-19T07:40:13.588Z installUpdated: 2018-06-19T07:40:13.588Z sessionExpiryTime: 2018-06-26T09:40:14.562Z deviceId: 520 === Testing installation === Installation valid: true this.serverPublicKey = [object Object] this.installToken = 07a84 === Testing session installation === this.sessionId = 7776 this.sessionToken = da85e Session valid: true sessionToken: da85e installToken: 07a84 === Testing installation === Installation valid: true this.serverPublicKey = [object Object] this.installToken = 07a84 === Testing device installation === Device valid: true this.deviceId: 520 === Testing session installation === this.sessionId = 7776 this.sessionToken = da85e Session valid: true
Problem
The problem arises when making requests. For example, running:
const users = await this.BunqJSClientInstance.getUsers(true);
Returns a bad Request Error.
Error: Request failed with status code 400 at createError (.../node_modules/axios/lib/core/createError.js:16:15) at settle (.../node_modules/axios/lib/core/settle.js:18:12) at IncomingMessage.handleStreamEnd (.../node_modules/axios/lib/adapters/http.js:201:11) at emitNone (events.js:111:20) at IncomingMessage.emit (events.js:208:7) at endReadableNT (_stream_readable.js:1064:12) at _combinedTickCallback (internal/process/next_tick.js:138:11) at process._tickDomainCallback (internal/process/next_tick.js:218:9) config: { adapter: [Function: httpAdapter], transformRequest: { '0': [Function: transformRequest] }, transformResponse: { '0': [Function: transformResponse] }, timeout: 0, xsrfCookieName: 'XSRF-TOKEN', xsrfHeaderName: 'X-XSRF-TOKEN', maxContentLength: -1, validateStatus: [Function: validateStatus], headers: { Accept: 'application/json, text/plain, */*', 'Cache-Control': 'no-cache', 'Content-Type': 'application/json', 'X-Bunq-Language': 'en_US', 'X-Bunq-Region': 'nl_NL', 'X-Bunq-Geolocation': '0 0 0 0 000', 'X-Bunq-Client-Request-Id': 1529408411554.417, 'X-Bunq-Client-Authentication': 'da85ef2fec1bbef32de55ccd76354c66a7b6751cfce469e9a450c71a80c7b225', 'User-Agent': 'Node-v8.11.2', 'X-Bunq-Client-Signature': 'R1alPcakYE3anVxJxklnaYbE37Wq2yYeK/AvxCodzjpnHBLPWt7YFx3PISDHoehGxL/X198BKbGrienxUF3xx81U8+Q5SCojOTXhhLE06LC0Cte1OTkXJ9kQelfcu61L7EjUC6Uxmy2gvJJS8Ocrt7gK7BIhSFsxvs6SkOTg8y33l+Cc3GMRm5ztrr7E57FxJ9HOVYeDWpEZBvw9ODLDh1uDs++yTfvrd1sU98r127p7+AvJYKvh3H1te/6UdcN+zNZCV0Ntjcqyqq/HGdtPocy5TDNP0+AKloYRhs1NiE9XSNcIMzOx+QrtgTPBHa0jYrZpLChLyak4RZ+GVKcyrA==', 'Content-Length': 2 }, method: 'get', url: 'https://public-api.sandbox.bunq.com/v1/user', data: '{}' },
Postman Test
I made a test with Postman my using the generated headers from the error message and everything works fine. Any ideas?