icastillejogomez / degiro-api

Unofficial DeGiro stock broker API. See your portfolio and set up orders in the market like wall street
MIT License
201 stars 30 forks source link

Uncaught Exception: badCredentials #56

Closed romerod closed 1 year ago

romerod commented 1 year ago

I'm trying to use the api (thank you) and I'm always getting an uncaught exception.

const degiro = new DeGiro.default.create({ username: args[0], pwd: args[1], oneTimePassword: args[2] }) const accountData = await degiro.login()

I've verified the arguments multiple times. Is there something I'm doing wrong?

Output with debug on:

node:internal/process/esm_loader:34 internalBinding('errors').triggerUncaughtException( ^ badCredentials (Usenode --trace-uncaught ...` to show where the exception was thrown)

Node.js v21.2.0 Making request to https://trader.degiro.nl/login/secure/login with options: { "method": "POST", "body": "{\"isPassCodeReset\":false,\"isRedirectToMobile\":false,\"password\":\"XXXXX\",\"username\":\"XXXXX\",\"oneTimePassword\":\"XXXXX\",\"queryParams\":{\"reason\":\"session_expired\"}}", "headers": { "Content-Type": "application/json" }, "credentials": "include", "referer": "https://trader.degiro.nl/trader/" } Sending OTP`

romerod commented 1 year ago

I don't know exactly what error I currently have when passing arguments, but it worked when passing them manually.