Skip to content
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

Unable to login #4

Open
chrisgorgo opened this issue Oct 1, 2018 · 8 comments
Open

Unable to login #4

chrisgorgo opened this issue Oct 1, 2018 · 8 comments

Comments

@chrisgorgo
Copy link

I'm trying to log in but I am getting the following reply

{"ts":1538424689127,"code":"1001","msg":"","data":{}}

I wonder if my password hash is correct. I used the following python code:

from hashlib import md5
md5(md5(b"test").hexdigest().encode()).hexdigest()

Does this look correct?

@theriley106
Copy link

@chrisfilo Were you able to resolve this login issue? I'm getting the same response back.

@chrisgorgo
Copy link
Author

chrisgorgo commented Oct 8, 2018 via email

@c4talyst
Copy link

Here is some sample Python which works for me:

import requests
from hashlib import md5
import time

API = "https://api.wyzecam.com:8443"
USERNAME = "user@emample.com"
_PASSWORD = b"password1"
PASSWORD = md5(md5(_PASSWORD).hexdigest().encode()).hexdigest()


def current_milli_time():
    return int(round(time.time() * 1000))


def login():
    url = API + "/app/user/login"

    headers = {
        "Content-Type": "application/json"
    }

    payload = {
        "sc": "f5609af3fa9541fd82a486df5fd9965a",
        "sv": "1ee66ee1fe03403b9ded3fe2fa869f2a",
        "app_ver": "com.hualai___2.0.18",
        "ts": current_milli_time(),
        "access_token": "",
        "phone_id": "bc151f39-787b-4871-be27-5a20fd0a1937",
        "user_name": USERNAME,
        "password": PASSWORD
    }

    print(payload)

    r = requests.post(url, headers=headers, json=payload)

    print(r.status_code)
    print(r.content)


if __name__ == "__main__":
    login()

@wesbos
Copy link
Contributor

wesbos commented Mar 1, 2019

I get the same issue - tried with CURL, JS and Python and I have an empty data each time.

@wesbos
Copy link
Contributor

wesbos commented Mar 1, 2019

Now I'm getting UserIsLocked :( Anyone have this happen to them? Seems to still work from the app

@wesbos
Copy link
Contributor

wesbos commented Mar 1, 2019

UserIsLocked can be resolved by resetting the password

@wesbos
Copy link
Contributor

wesbos commented Mar 1, 2019

turns out this was because I didn't RTFM and md5(md5(password)) - logged in now.

here is a JS example:

const axios = require('axios');
const md5 = require('md5');

const endpoint = `https://api.wyzecam.com:8443`;

const payload = {
  sc: 'f5609af3fa9541fd82a486df5fd9965a',
  sv: '1ee66ee1fe03403b9ded3fe2fa869f2a',
  app_ver: 'com.hualai___1.1.52',
  ts: 1524248711789,
  access_token: '',
  phone_id: 'bc151f39-787b-4871-be27-5a20fd0a1937',
  user_name: 'you@you.com',
  password: md5(md5('password')),
};

const config = {
  headers: {
    'Content-Type': 'application/json',
  },
};

async function getToken() {
  console.log('Fetching token');
  let token;

  if (token) {
    return token;
  }
  const { data } = await axios.post(
    `${endpoint}/app/user/login`,
    payload,
    config
  );
  console.log(data);
  return data;
}

async function go() {
  getToken().catch(console.error);
}

go().catch(console.error);

@jessewriter
Copy link

this js code didn't work for me, data is still empty { }

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

5 participants