fhqvst / avanza

A JavaScript client for the unofficial Avanza API
MIT License
229 stars 59 forks source link

Cannot load due to access control checks #55

Closed 3DJakob closed 3 years ago

3DJakob commented 3 years ago

I tried the sample code in your readme however I cannot seem to be able to connect to the server due to being on a different URL. Have they closed down the API to internal use only or am I missing something?

avanza.authenticate({
      username: 'myUserName',
      password: 'myPassword',
      totpSecret: 'mySecret'
}).then(async () => {
      const positions = await avanza.getPositions()
      console.log(positions)
})

Screenshot 2021-01-21 at 13 54 15

fhqvst commented 3 years ago

Browsers do not allow you to connect to other origins. You'll have to run it on the server-side, or in a framework like Electron.

3DJakob commented 3 years ago

Yup thought so much. Got it working in electron 👍