Closed davidsoederberg closed 3 years ago
I did some investigation and found out that it must be something wrong with the request function in index.js. I am not an expert in encoding, but I edited to this in the header 'Content-Type': 'application/json;charset=utf-8',
and it still did not work.
I then tried with axios instead of https.request
(changed from request to axios on line 405 in index.js) and then it worked fine with 'ö'.
Does someone have a solution for this problem with https.request
or should we switch to axios on line 405 so you can have special chars in your username? (There might be other places where the nordic special letters gives us problem though)
My guess is that you get the wrong Content-Length
e.g change
https://github.com/fhqvst/avanza/blob/master/lib/index.js#L53
to 'Content-Length': Buffer.byteLength(data)
@stoffeastrom It works fine with having usernames with nordic letters after your simple change. I made a pull request #44, might need some more testing .
The authenticate function returns
bad request
if you have 'ö' in your username. I changed username to one without 'ö' and then it worked fine.I do not know if this can be fixed, but atleast we could add a warning if someone tries to authenticate with 'å', 'ä' or 'ö' in their username.