tdlib / td

Cross-platform library for building Telegram clients
https://core.telegram.org/tdlib
Boost Software License 1.0
7.07k stars 1.44k forks source link

Valid api_id must be provided error #2285

Closed selankon closed 1 year ago

selankon commented 1 year ago

Hi,

I had a working client with a valid api_id and everything working in my computer, but I bought a new one, so on the moving I tried to move also this project.

I moved the project itself, installed the dependencies, and build the tdlib on the new computer (https://github.com/tdlib/td/commit/d912fd14311fec0d5d6b81359a4bc7d9ce2b0996). Also I moved the tdlib files folder.

But when I try to run my client, with the original client stopped, I got this error:

Telegram error: {'@type': 'error', 'code': 400, 'message': 'Valid api_id must be provided. Can be obtained at https://my.telegram.org', '@extra': {'request_id': 'updateAuthorizationState'}}

I also tried removing tdlib files but the error is the same. I'm using python_telegram tdlib wrapper but I'm pretty sure this is a tdlib issue, i guess.

Anybody knows what can be the problem?

levlam commented 1 year ago

TDLib API is different for each TDLib version. You need to update the code accordingly to use the corresponding TDLib API. In particular, setTdlibParameters method was changed.

selankon commented 1 year ago

But if I'm using TDLib on the same commit number, is not supposed to be the same? Could you point me where can I check the changes please? I'm using this commit https://github.com/tdlib/td/commit/d912fd14311fec0d5d6b81359a4bc7d9ce2b0996 on both

levlam commented 1 year ago

The full scheme can be found at https://github.com/tdlib/td/blob/d912fd14311fec0d5d6b81359a4bc7d9ce2b0996/td/generate/scheme/td_api.tl.

If you don't call setTdlibParameters explicitly, it may be called implicitly by the wrapper. If wrapper version is different, you can receive the error.

selankon commented 1 year ago

The wrapper is on the same version, however, on one place I'm using python 3.9 and on the other 3.8. Could be that, but probably not.

Either could be that my first compilation on the new place was on the last commit, but then I rollback to the same as on the first computer and built again. Maybe library files are not updated properly?

I need to go deeper, thanks for help, I will update a soon i have relevant information.

selankon commented 1 year ago

I found that the client was accesing to a newer version of the TDLib. So I deleted it again, and compiled it again, given execution permissions with +x and nothing. The problem persists... No idea what could be. Is a Debian 11 BTW

levlam commented 1 year ago

You are very likely to have different TDLib versions. You can check the version sending getOption("version") request.

selankon commented 1 year ago

Ok you were right, I was using a different tdlib version. On the original computer I was not using the version I guess since after compile it was never installed on my laptop. Instead I was using the librari bundled TDLib 1.8.5.

On the new computer, the lib was properly installed, so after downgrade it to 1.8.5 I got it working. Check related issue https://github.com/alexander-akhmetov/python-telegram/issues/348

So, at the end, it wasn't needed to compile the library on my own because the python package had one already ready.

Thanks for all