Node.js 使用电报mtproto验证密钥为空错误
我将此代码与使用Node.js 使用电报mtproto验证密钥为空错误,node.js,telegram,Node.js,Telegram,我将此代码与使用“电报mtproto”:“^2.2.2” 调用此脚本时,我得到: [7.244]错误401身份验证密钥为空2 1, [7.730]错误401身份验证密钥未注册2 1 错误,但我无法理解我的代码出了什么问题,我所发现的就是这个问题,它没有任何合适的答案 const App ={ appId: //myAppId, hash : // my app hash } const MTProto = require( 'telegram-mtproto').MTProto co
“电报mtproto”:“^2.2.2”
调用此脚本时,我得到:
[7.244]错误401身份验证密钥为空2 1
,
[7.730]错误401身份验证密钥未注册2 1
错误,但我无法理解我的代码出了什么问题,我所发现的就是这个问题,它没有任何合适的答案
const App ={
appId: //myAppId,
hash : // my app hash
}
const MTProto = require( 'telegram-mtproto').MTProto
const api = {
layer : 57,
initConnection : 0x69796de9,
api_id : App.appId
}
const server = {
dev: false
}
const client = MTProto({ server, api })
async function sendCode(phoneNumber){
console.log("sendCode called")
try {
const {phone_code_hash} = await client('auth.sendCode', {
phone_number: phoneNumber,
current_number: false,
api_id: App.appId,
api_hash: App.hash
})
console.log("phoneCode sent", {phone_code_hash})
} catch (e) {
console.log("error ", e)
}
}
sendCode(process.env.PHONE_NUMBER)