southbridgeio / tdlib-ruby

Ruby bindings and client for TDLib
MIT License
94 stars 45 forks source link

Getting status Unauthorized on login attempt. #65

Closed tilvin closed 3 months ago

tilvin commented 3 months ago

I was logged in and use this lib. Then i call client.destroy instead of client.dispose by accident. Now each time i try to authorize, i receive: {"@type":"error","code":401,"message":"Unauthorized","@extra":"some extra"}

For example:

client.set_authentication_phone_number(phone_number: '+tel number', settings: nil).wait
-> getting code
client.check_phone_number_verification_code(code:  'received code').wait
-> {"@type":"error","code":401,"message":"Unauthorized","@extra":"some extra"}

Or:

client.request_qr_code_authentication(other_user_ids: nil).wait
-> getting link
client.confirm_qr_code_authentication(link: "tg://login?token=received link")
-> {"@type":"error","code":401,"message":"Unauthorized","@extra":"some extra"}

Does anyone have any clue?

annovikava commented 3 months ago

Hello. Try to use client.check_authentication_code(code: 'your code') instead of check_phone_number_verification_code. Write me if it helps, please

tilvin commented 3 months ago

Well, now after attempt to get a code i receive this:

client.set_authentication_phone_number(phone_number: '+ phone', settings: nil).wait

->  #<TD::Types::Error code=406 message="UPDATE_APP_TO_LOGIN">
 {"@type":"updateServiceNotification","type":"API_64BIT_LOGIN_APP_OUTDATED_262","content":{"@type":"messageText","text":{"@type":"formattedText","text":"You are using an outdated app that is no longer supported. To access your messages, please update your app to the latest version. If you don\u2019t know how to update your app, go to https://telegram.org/dl","entities":[{"@type":"textEntity","offset":91,"length":37,"type":{"@type":"textEntityTypeBold"}},{"@type":"textEntity","offset":178,"length":23,"type":{"@type":"textEntityTypeUrl"}}]}}}

UPD: i install more up-to-date version of TDLib. Unf, it does't cooperate with ruby lib, at the moment i'm trying to inline them and make it work.

UPD 2: client.check_phone_number_verification_code doesn't work for me anymore in , but client.check_authentication_code works like a charm, thanks @annovikava!