Skip to content
This repository has been archived by the owner on Feb 11, 2023. It is now read-only.

Commit

Permalink
fix: add required data to withings login request
Browse files Browse the repository at this point in the history
closes #3
  • Loading branch information
dhayab committed Feb 20, 2020
1 parent 97b86c0 commit d567a44
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
],
"scripts": {
"start": "npm run -s build && npm run -s start:homebridge",
"start:homebridge": "homebridge -D -P ./ -U ./",
"start:homebridge": "homebridge -D -I -P ./ -U ./",
"dev": "concurrently --kill-others npm:dev:parcel npm:dev:nodemon",
"dev:parcel": "parcel src/*.ts --target node --no-source-maps",
"dev:nodemon": "nodemon dist/index.ts",
Expand Down
5 changes: 4 additions & 1 deletion src/lib/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@ export class WithingsApi {
}

private async connect() {
const query = await agent.post(Api.Connect).field('email', this.email).field('password', this.password);
const query = await agent.post(Api.Connect)
.field('email', this.email).field('password', this.password)
.field('use_2fa', '').field('is_admin', 'f')
;
const error = (query.text.replace(/[\n|\r|\t]/g, '').match(/<div class="alert alert-danger"><li>(.+?)<\/li><\/div>/) || [])[1];

if (error) {
Expand Down

0 comments on commit d567a44

Please sign in to comment.