nlrb / bsh-api

NodeJS interface for the Bosch Siemens Home-Connect API.
Apache License 2.0
9 stars 2 forks source link

Getting SyntaxError: Unexpected identifier #1

Closed emeins closed 6 years ago

emeins commented 6 years ago

When I execute node home-connect.js I get a syntax error: /home/pi/bsh-api/index.js:182 async _executeCall(api, params, body) { ^^^^^^^^^^^^

SyntaxError: Unexpected identifier at exports.runInThisContext (vm.js:53:16) at Module._compile (module.js:373:25) at Object.Module._extensions..js (module.js:416:10) at Module.load (module.js:343:32) at Function.Module._load (module.js:300:12) at Module.require (module.js:353:17) at require (internal/module.js:12:17) at Object. (/home/pi/bsh-api/test/home-connect.js:3:13) at Module._compile (module.js:409:26) at Object.Module._extensions..js (module.js:416:10)

nlrb commented 6 years ago

node --version?

emeins commented 6 years ago

Well, I checked this. It is 4.4.5 which is quite old.

A try on another machine delivered (version = v8.9.1): https://developer.home-connect.com/security/oauth/authorize?client_id=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&redirect_uri=https://apiclient.home-connect.com/o2c.html&response_type=code&scope=IdentifyAppliance Monitor *-Control Settings&state=xxxxxx-xxxxx-xxxxxx-xxxxx-xxxxxxxx error=invalid_scope&error_description=given+scope+doesn't+match+requested+scope

Are there any parameters I have to consider when I execute "node home-connect.js"?

nlrb commented 6 years ago

For the first issue, you need at least node v8 for async/await.

For the second issue: the test is by default set up for an 'Advanced Account'. You probably have a 'Basic' account, i.e. you won't be able to get the authorization scope you requested (no permission for '*-Control' and '*-Settings'). See https://developer.home-connect.com/?q=docs/api/authorization/scope

emeins commented 6 years ago

I checked it with node version v9.1.0 and it's working fine now.