Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

auth_key_id mismatch after logOut #1579

Open
keleftheriou opened this issue Jun 21, 2021 · 13 comments
Open

auth_key_id mismatch after logOut #1579

keleftheriou opened this issue Jun 21, 2021 · 13 comments

Comments

@keleftheriou
Copy link

I sometimes (but not always) see this type of error right after logging out. I’m not sure what it means or why it’s happening:

Session closed: [Error : 0 : Invalid mtproto message: auth_key_id mismatch [found = 0x0a0d3e6c6d84683c] [expected = 0xba91dcf84a3bff0a]] Session:1:main::Connect::HttpLongPoll::[123.123.123.123:443] to DcId{1} over HTTP

When the error occurs, my client never receives the final AuthorizationStateClosed update.

@levlam
Copy link
Contributor

levlam commented Jun 21, 2021

Are you using TDLib on watchOS?

@keleftheriou
Copy link
Author

Yes, I am using it on watchOS.

@levlam
Copy link
Contributor

levlam commented Jun 21, 2021

What is probability of getting this error?

@keleftheriou
Copy link
Author

About half the time. Is this somehow specific to watchOS?

@levlam
Copy link
Contributor

levlam commented Jun 21, 2021

The problem is in HTTP transport and it currently used by default only on watchOS.

@keleftheriou
Copy link
Author

You mean instead of HTTPS? Is it possible to change the default transport used on watchOS?

I’m currently using TdJson. Is the C++ TdStatic version any different in this regard?

Otherwise, what is the preferred way to build a watchOS client?

@levlam
Copy link
Contributor

levlam commented Jun 21, 2021

No. On all other OS TCP transport is used by default. There is no access to raw sockets on watchOS, so it is forced to use HTTP transport.

@keleftheriou
Copy link
Author

It appears this might have changed with watchOS 6, see here: socketio/socket.io-client-swift#1215

From the watchOS 6 release notes:

URLSessionWebSocketTask and URLSessionStreamTask are now available for use in watchOS apps. (49779789)

Also URLSessionDataTask supports HTTPS.

Are any of these technically sufficient for a Telegram client on watchOS, if one was willing to spend the time to make the necessary changes?

@levlam
Copy link
Contributor

levlam commented Jun 21, 2021

HTTPS makes no difference. Telegram doesn't have HTTP/HTTPS API. HTTP is used only as a transport.

@keleftheriou
Copy link
Author

Thanks.

Is any of URLSessionWebSocketTask / URLSessionStreamTask / URLSessionDataTask technically sufficient for a Telegram client on watchOS, if one was willing to spend the time to make the necessary changes?

I’m trying to determine if I should build an independent watchOS client or not.

@levlam
Copy link
Contributor

levlam commented Jun 21, 2021

TDLib already uses URLSessionDataTask. Existence of others makes no difference and is irrelevant to the issue.

@keleftheriou
Copy link
Author

I see. Then what are the implications of TDLib using HTTP transport on watchOS?

Are there any security concerns or other downsides?

And is there anything I can do to prevent or handle the auth_key_id mismatch error?

@levlam
Copy link
Contributor

levlam commented Jun 22, 2021

There are no downsides, except it is suboptimal, but watchOS has no better alternatives anyway. The error can't be avoided and needs to be properly handled in TDLib.

@levlam levlam reopened this Jul 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants