zerobias / telegram-mtproto

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

IOS PHONE_MIGRATE_ error w/ auth.sendCode #68

Closed sofqi closed 5 years ago

sofqi commented 7 years ago

Using:

@ionic/app-scripts : 2.1.3
Cordova Platforms  : android 6.2.3 ios 4.4.0
Ionic Framework    : ionic-angular 3.6.0

System:

Android SDK Tools : 26.0.2
Node              : v7.4.0
OS                : macOS Sierra
Xcode             : Xcode 8.3.3 Build version 8E3004b 
ios-deploy        : 1.9.1 
ios-sim           : 6.0.0 
npm               : 5.3.0 

Every time I use (I tried it without the dcID parameters as well)

     client('auth.sendCode', {
        phone_number: phoneNumber,
        current_number: false, //true/false didn't matter
        api_id: api.api_id,
        api_hash: api_hash
      }, { dcID: 1, fileDownload: false, createNetworker: true })

I get a PHONE_MIGRATE_1 error on the IOS simulator (I haven't even bothered trying it on an iPhone yet since it doesn't work in the simulator)

Addendum: I also get NETWORK_MIGRATE_1 with

      client('auth.checkPhone', {
        phone_number: phoneNumber
      }).then(
        (phone_code_hash) => {
          client('help.getConfig').then(resp => console.log(resp));
          console.log(phone_code_hash);
          resolve(phone_code_hash);
        }).catch(err => {
          //client('help.getConfig').then(resp => console.log(resp));
          console.log(err);
          reject(err);
        });
wfjsw commented 7 years ago
303 SEE_OTHER | PHONE_MIGRATE_X | Repeat the query to data-center X
wfjsw commented 7 years ago

Try to use the most latest code and remove , { dcID: 1, fileDownload: false, createNetworker: true } this part

sofqi commented 7 years ago

Installed newest version (also installed npm install https://github.com/zerobias/telegram-mtproto.git#feature/mtproto3) and removed the code to try to force dcID of 1

Still got a PHONE_MIGRATE_1 error

help.getConfig shows that I am connecting to DC 2.

wfjsw commented 7 years ago

Yes, I can confirm the automatic DC change is broken.

ehsan89 commented 7 years ago

Any updates on automatic DC change here? @zerobias @goodmind

zerobias commented 7 years ago

@ehsan89 yes, try telegram-mtproto 3.2.2. The new version can detect migration errors and read current DC from storage