我已经发送了 auth.sendCode
方法,响应如下:
('sentCode: ', {u'req_msg_id': 6324698204597889024L, u'result': {u'type': {u'len
gth': 5}, u'phone_registered': False, u'flags': 6, u'timeout': 120, u'next_type'
: {}, u'phone_code_hash': '52eb4ab096ea211b52'}})
这是使用 Telegram 测试服务器。我已成功在 telegram iPhone 应用程序和桌面应用程序中使用相同的电话号码,因此我知道该电话号码在生产中有效。 (它在测试服务器上也应该有效吗?)
当我使用 auth.signIn
遵循 auth.sendCode
时,我收到以下错误响应:
('authorization: ', {u'error_message': 'PHONE_NUMBER_UNOCCUPIED', u'error_code':
400})
这两种方法之间是否有注册电话号码的步骤?
最佳答案
来自 https://core.telegram.org/api/auth
The auth.sendCode method will also return the phone_registered field, which indicates whether or not the user with this phone number is registered in the system. If phone_registered == boolTrue, authorization requires that auth.signIn be invoked. Otherwise, basic information must be requested from the user and the new user registration method (auth.signUp) must be invoked.
When phone_registered === boolFalse, the auth.signIn method can be used to pre-validate the code entered from the text message. The code was entered correctly if the method returns Error 400 PHONE_NUMBER_UNOCCUPIED.
关于python - 为什么在 telegram 中调用 auth.signIn 时会收到 PHONE_NUMBER_UNOCCUPIED 错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39236105/