GithubHelp home page GithubHelp logo

unable to log in about mtproto-core HOT 23 CLOSED

alik0211 avatar alik0211 commented on August 25, 2024
unable to log in

from mtproto-core.

Comments (23)

somgupta13 avatar somgupta13 commented on August 25, 2024

`const { MTProto } = require('@mtproto/core');
const prompt = require('prompt');

const mtproto = new MTProto({
api_id: 105,
api_hash: '85b728',

test: false,
});

const phone = '+91808';
const code = '2222';
// const password = 'hellojs';

function sendCode(phone) {
console.log("hello");
return mtproto.call('auth.sendCode', {
api_id: 1056,
api_hash: '85b72864f343b734',
// current_number: false,
phone_number: phone,
settings: {
_: 'codeSettings',
},
})
// .catch(error=>{console.log(error)});
}

sendCode(phone)
.catch(error => {
if (error.error_message.includes('MIGRATE')) {
const [type, nextDcId] = error.error_message.split('MIGRATE');

  mtproto.setDefaultDc(+nextDcId);

  return sendCode(phone).catch(error=>{console.log(error)});;

}
})
.then( result => {
f1(result.phone_code_hash);

})

async function f1(phone_code_hash){
prompt.start();
await prompt.get(['username'], async function (err, result) {
if (err) { console.log(err); }
else{
// console.log(phone,phone_code_hash,result.username);
// console.log(typeof(result.username));

	const { user } = await mtproto.call('auth.signIn', {
		phone_number   : phone,
		phone_code_hash: phone_code_hash,
		phone_code     : result.username
	}).then(result => {
		console.log("Logged:", result);
		console.log("Logged:", result.user);

return result;
}).catch(error => {
console.log("ff")
console.log(error);
process.exit();
});

}
});
}

`

from mtproto-core.

kolko123 avatar kolko123 commented on August 25, 2024

how should i get the code?

from mtproto-core.

kolko123 avatar kolko123 commented on August 25, 2024

`const { MTProto } = require('@mtproto/core');
const prompt = require('prompt');

const mtproto = new MTProto({
api_id: 105,
api_hash: '85b728',

test: false,
});

const phone = '+91808';
const code = '2222';
// const password = 'hellojs';

function sendCode(phone) {
console.log("hello");
return mtproto.call('auth.sendCode', {
api_id: 1056,
api_hash: '85b72864f343b734',
// current_number: false,
phone_number: phone,
settings: {
_: 'codeSettings',
},
})
// .catch(error=>{console.log(error)});
}

sendCode(phone)
.catch(error => {
if (error.error_message.includes('MIGRATE')) {
const [type, nextDcId] = error.error_message.split('MIGRATE');

  mtproto.setDefaultDc(+nextDcId);

  return sendCode(phone).catch(error=>{console.log(error)});;

}
})
.then( result => {
f1(result.phone_code_hash);

})

async function f1(phone_code_hash){
prompt.start();
await prompt.get(['username'], async function (err, result) {
if (err) { console.log(err); }
else{
// console.log(phone,phone_code_hash,result.username);
// console.log(typeof(result.username));

	const { user } = await mtproto.call('auth.signIn', {
		phone_number   : phone,
		phone_code_hash: phone_code_hash,
		phone_code     : result.username
	}).then(result => {
		console.log("Logged:", result);
		console.log("Logged:", result.user);

return result;
}).catch(error => {
console.log("ff")
console.log(error);
process.exit();
});

}
});
}

`

hello
(node:17837) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'phone_code_hash' of undefined

from mtproto-core.

somgupta13 avatar somgupta13 commented on August 25, 2024

https://github.com/somgupta13/Telegram-API/blob/master/som.js

from mtproto-core.

kolko123 avatar kolko123 commented on August 25, 2024

https://github.com/somgupta13/Telegram-API/blob/master/som.js

same problem

from mtproto-core.

somgupta13 avatar somgupta13 commented on August 25, 2024

Do you have node 12version?

from mtproto-core.

kolko123 avatar kolko123 commented on August 25, 2024

Do you have node 12version?

node v12.16.2

npm 6.14.4

from mtproto-core.

somgupta13 avatar somgupta13 commented on August 25, 2024

code is working for me

from mtproto-core.

kolko123 avatar kolko123 commented on August 25, 2024

code is working for me

I should specify only api_id and api_hash and phone number?

from mtproto-core.

somgupta13 avatar somgupta13 commented on August 25, 2024

yes

from mtproto-core.

kolko123 avatar kolko123 commented on August 25, 2024

yes

а что-то еще должно быть установлено?

from mtproto-core.

somgupta13 avatar somgupta13 commented on August 25, 2024

are you recieving otp?

from mtproto-core.

kolko123 avatar kolko123 commented on August 25, 2024

are you recieving otp?

what is it?

from mtproto-core.

somgupta13 avatar somgupta13 commented on August 25, 2024

are you recieving the otp on telegram number

from mtproto-core.

kolko123 avatar kolko123 commented on August 25, 2024

i don't get anything

are you recieving the otp on telegram number

from mtproto-core.

somgupta13 avatar somgupta13 commented on August 25, 2024

type your mobile number in international format

from mtproto-core.

kolko123 avatar kolko123 commented on August 25, 2024

type your mobile number in international format

it is introduced in an international format

from mtproto-core.

somgupta13 avatar somgupta13 commented on August 25, 2024

https://github.com/somgupta13/Telegram-API/blob/master/som.js
try this i have updated else show your code

from mtproto-core.

kolko123 avatar kolko123 commented on August 25, 2024

https://github.com/somgupta13/Telegram-API/blob/master/som.js
try this i have updated else show your code

same problem

from mtproto-core.

alik0211 avatar alik0211 commented on August 25, 2024

@kolko123

  1. What version of the library do you use?
  2. Show your code
  3. Is Telegram blocked in your country? VPN enabled (try open telegram.org)?

from mtproto-core.

alik0211 avatar alik0211 commented on August 25, 2024

@kolko123 if you don't send an info by may 11 I'll close the issue

from mtproto-core.

flaviolacer avatar flaviolacer commented on August 25, 2024

Version 3.1.0 keep stuck on promise

ex:

client.call('auth.signIn', {
            phone_number: state.phone_number,
            phone_code_hash: state.phone_code_hash,
            phone_code: state.code
        }).then(message => {
            console.log("Logged:", message); // never happen
            return message;  // never happen
        }).catch(error => {
            console.log(error);
            process.exit();
        });

On telegram app says that i logged.

from mtproto-core.

alik0211 avatar alik0211 commented on August 25, 2024

This error is probably fixed in version 3.1.1. View more: https://t.me/mtproto_core/17

from mtproto-core.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.