zerobias / telegram-mtproto

Telegram client api (MTProto) library
MIT License
620 stars 136 forks source link

Auth_key_empty #98

Closed Alavi1412 closed 5 years ago

Alavi1412 commented 7 years ago

I got the Auth_key_empty error for using some countries.

await client.storage.clear();

    let phone = await inputField.inputField('phone');

    const  phone_code_hash  = await client('auth.sendCode', {
        phone_number  : phone,
        current_number: true,
        api_id        : 166413,
        api_hash      : '89c7f8a6b55d6b50b078203405da032e'
    });

    const code = await inputField.inputField('code');

    const user = await client('auth.signUp', {
        phone_number   : phone,
        phone_code_hash: phone_code_hash.phone_code_hash+ "",
        phone_code     : code + "",
        first_name     : "hassan"
    });
    const log = await client('auth.signIn', {
        phone_number   : phone,
        phone_code_hash: phone_code_hash.phone_code_hash+ "",
        phone_code     : code + ""
    });

    await client.storage.save();

This code works well for Iran or Russia but throw error for united_states or china. What is the problem

goodmind commented 7 years ago

What error you get?

2012mjm commented 6 years ago

i have a similar problem Error 401 AUTH_KEY_EMPTY 2 4

This code works well for Iran or Russia but throw error for united_states or china.

That's exactly the same for me

I think it's due to the data center's address

2012mjm commented 6 years ago

Use version 3.2.11 npm i -S telegram-mtproto@alpha

flavianohonorato commented 6 years ago

I had this same problem, I updated the version with npm i -S telegram-mtproto @ alpha and now I get the following error when I use thesendInvites ()endpoint:

screen shot 2018-01-29 at 07 53 54