MahjongRepository / mahjong_soul_api

Python wrapper for the Mahjong Soul (Majsoul) Protobuf objects. It allows to use their API.
72 stars 10 forks source link

error code 1003 #24

Closed iceshoesss closed 8 months ago

iceshoesss commented 8 months ago

I give endpoint a value directly like this to login in CN server

async def connect():
    # async with aiohttp.ClientSession() as session:
    #   async with session.get("{}/api/customized_contest/random".format(MS_MANAGER_API_URL)) as res:
    #         servers = await res.json()
    #         endpoint_gate = servers['servers'][0]
    #         endpoint = "wss://{}/".format(endpoint_gate)
    endpoint = "wss://common-v2.maj-soul.com/contest_ws_gateway"

And write login func like this:

async def login(manager_api, userid,password):
    logging.info("")
    logging.info("Login with OAuth2 access token to manager panel")

    req = pb.ReqContestManageLogin()
    print(req)
    # req.type = 7
    req.account = userid
    req.password = password
    # req.gen_access_token = True

    res = await manager_api.login_contest_manager(req)

Received error 1003

error {
  code: 1003
}

What does it mean? and how to login crorrectly? Thank you for the repository first! And how to deal with the error?

iceshoesss commented 8 months ago
    req.type = 7
    req.account = userid
    # req.password = password
    req.password = hmac.new(b"lailai", password.encode(), hashlib.sha256).hexdigest()
    req.gen_access_token = True

I translated password format like thishmac.new(b"lailai", password.encode(), hashlib.sha256).hexdigest()

error 1002 occurred

Where can I get what the error mean?

iceshoesss commented 8 months ago
    req.type = 7
    req.account = userid
    # req.password = password
    req.password = hmac.new(b"lailai", password.encode(), hashlib.sha256).hexdigest()
    req.gen_access_token = True

I translated password format like thishmac.new(b"lailai", password.encode(), hashlib.sha256).hexdigest()

error 1002 occurred

Where can I get what the error mean?

commented out req.gen_access_token = True it works! though I don't know how it works!