8000 TypeError [ERR_HTTP_INVALID_HEADER_VALUE]: Invalid value "undefined" for header "X-AuthenticationSession" · Issue #85 · fhqvst/avanza · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

TypeError [ERR_HTTP_INVALID_HEADER_VALUE]: Invalid value "undefined" for header "X-AuthenticationSession" #85

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
filipfellman opened this issue Jan 3, 2023 · 1 comment

Comments

@filipfellman
Copy link
filipfellman commented Jan 3, 2023

I get following error with this code, not sure what I'm doing wrong..

const Avanza = require('avanza')
const avanza = new Avanza()

console.log(avanza)

var user = 'fellmanfilip'

avanza.authenticate({
  username: user,
  password: '***********',
  totpSecret: '****************************************'
}).then(async () => {
  console.log("Successfully authenticated for %s", user)
  console.log("Trying to fetch current positions for %s", user)
  const positions = await avanza.getPositions()
  console.log("Successfully fetched current positions for %s", user)
  console.log(positions)
}).catch(e => { console.log(`Failed to fetch current positions for ${user} due to\n`, e) })
PS C:\Users\ffellman\private_projects> node .\display_savings.js
Avanza {
  _events: [Object: null prototype] {},
  _eventsCount: 0,
  _maxListeners: undefined,
  _credentials: null,
  _socket: null,
  _authenticated: false,
  _authenticationSession: null,
  _authenticationTimeout: 1440,
  _pushSubscriptionId: null,
  _reauthentication: null,
  _customerId: null,
  _securityToken: null,
  _backOffTimestamps: {},
  _socketHandshakeTimer: null,
  _socketSubscriptions: {},
  _socketMonitor: null,
  _socketLastMetaConnect: 0,
  _adviceTimeout: 30000,
  _socketConnected: false,
  _socketMessageCount: 1,
  _socketClientId: null,
  [Symbol(kCapture)]: false
}
Successfully authenticated for fellmanfilip
Trying to fetch current positions for fellmanfilip
Failed to fetch current positions for fellmanfilip due to
 TypeError [ERR_HTTP_INVALID_HEADER_VALUE]: Invalid value "undefined" for header "X-AuthenticationSession"
    at ClientRequest.setHeader (node:_http_outgoing:647:3)
    at new ClientRequest (node:_http_client:284:14)
    at Object.request (node:https:360:10)
    at C:\Users\ffellman\private_projects\node_modules\avanza\dist\index.js:53:23
    at new Promise (<anonymous>)
    at request (C:\Users\ffellman\private_projects\node_modules\avanza\dist\index.js:52:10)
    at C:\Users\ffellman\private_projects\node_modules\avanza\dist\index.js:934:9
    at new Promise (<anonymous>)
    at Avanza.call (C:\Users\ffellman\private_projects\node_modules\avanza\dist\index.js:930:12)
    at Avanza.getPositions (C:\Users\ffellman\private_projects\node_modules\avanza\dist\index.js:600:17) {
  code: 'ERR_HTTP_INVALID_HEADER_VALUE'
}
@origooo
Copy link
origooo commented May 15, 2024

I had the same issue until I activated 2FA/MFA. For a while, I forgot to actually complete the activation on avanza.se after I got the initial key.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
0