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

Error "Valid api_id must be provided" only on x64 #2211

Closed
Maddest opened this issue Nov 25, 2022 · 7 comments
Closed

Error "Valid api_id must be provided" only on x64 #2211

Maddest opened this issue Nov 25, 2022 · 7 comments

Comments

@Maddest
Copy link

Maddest commented Nov 25, 2022

Hi,
I'm using the tdjson.dll v1.8.8 compiled for Windows C++ win64. All library functions work fine. However, after I have received the 'authorizationStateWaitTdlibParameters' I use 'td_send' to send the following JSON auth string:

{
"@type":"setTdlibParameters",
"parameters":
{
"use_test_dc":false,
"database_directory":"",
"files_directory":"",
"database_encryption_key":[],
"use_file_database":false,
"use_chat_info_database":false,
"use_message_database":false,
"use_secret_chats":false,
"api_id":12345,
"api_hash":"xxxxxxxxxxxxxxxxxxxx",
"system_language_code":"en",
"device_model":"Desktop",
"system_version":"",
"application_version":1,
"enable_storage_optimizer":1,
"ignore_file_names":false
}
}

I have followed the hints from #2155 and changed the JSON string accordingly, but then I get a JSON parse error (expecting string, not array).

Any hints what I'm doing wrong here? Thanks a lot!

@levlam
Copy link
Contributor

levlam commented Nov 25, 2022

"database_encryption_key" should be a base64-encoded binary string and not an array.

@Maddest
Copy link
Author

Maddest commented Nov 25, 2022

Thanks. I don't have any database encryption keys, so I leave them empty. The last JSON string I used as follows, but I still get the API_ID invalid error.

{
"@type":"setTdlibParameters",
"parameters":
{
"use_test_dc":false,
"database_directory":"",
"files_directory":"",
"database_encryption_key":"",
"use_file_database":false,
"use_chat_info_database":false,
"use_message_database":false,
"use_secret_chats":false,
"api_id":1245678,
"api_hash":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"system_language_code":"en",
"device_model":"Desktop",
"system_version":"",
"application_version":"0.1",
"enable_storage_optimizer":false,
"ignore_file_names":false
}
}

Did I miss something different? I tried so many combinations, but it won't work.

@Maddest
Copy link
Author

Maddest commented Nov 25, 2022

I have downgraded to v1.8.1 and now it's working with the following JSON:

{"@type":"setTdlibParameters","parameters":{"use_test_dc":true,"database_directory":"C:\xxxxxxxxxxxxxxxxxxxx","files_directory":"","use_file_database":true,"use_chat_info_database":true,"use_message_database":true,"use_secret_chats":true,"api_id":12345678,"api_hash":"xxxxxxxxxxxxxxxxxxxxxx","system_language_code":"en","device_model":"Desktop","system_version":"0.1","application_version":"0.1","enable_storage_optimizer":true,"ignore_file_names":true}}

Since which version is use_test_dc available?

@AYMENJD
Copy link
Contributor

AYMENJD commented Nov 25, 2022

@Maddest Starting from TDLib v1.8.6+ setTdlibParameters values must be inlined and i can see in your JSON examples you haven't inlined the parameters.

To inline setTdlibParameters values remove the key/array parameters. So your JSON will be like:

{
"@type":"setTdlibParameters",
"use_test_dc":false,
"database_directory":"",
"files_directory":"",
"database_encryption_key":"",
"use_file_database":false,
"use_chat_info_database":false,
"use_message_database":false,
"use_secret_chats":false,
"api_id":1245678,
"api_hash":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"system_language_code":"en",
"device_model":"Desktop",
"system_version":"",
"application_version":"0.1",
"enable_storage_optimizer":false,
"ignore_file_names":false
}

This should work fine in TDLib 1.8.6+. Also i suggest you to read this #2155 (comment)

@Maddest
Copy link
Author

Maddest commented Nov 25, 2022

@AYMENJD That works great...thank you very much for this information. It saved me hours 🥇

Are these changes documented somewhere? Can't find any changelogs.

@AYMENJD
Copy link
Contributor

AYMENJD commented Nov 25, 2022

Yes but not in changelogs. Everytime you update TDLib you must check changes made to td_api.tl which is TDLib API scheme file. Which will help you to know more about the latest API changes.

@Maddest
Copy link
Author

Maddest commented Nov 26, 2022

@AYMENJD Thanks. I'll check this file from time to time. However, a page with all changes listed for each version would be very handy though.

@Maddest Maddest closed this as completed Nov 26, 2022
FASKHETDINOV added a commit to FASKHETDINOV/phptdlib that referenced this issue Jan 29, 2023
Starting from TDLib v1.8.6+ setTdlibParameters values must be inlined and i can see in your JSON
tdlib/td#2211
yaroslavche added a commit to yaroslavche/phptdlib that referenced this issue Jan 29, 2023
* Removed the value of 'parameters'

Starting from TDLib v1.8.6+ setTdlibParameters values must be inlined and i can see in your JSON
tdlib/td#2211

* 1.8.10

---------

Co-authored-by: yaroslavche <yaroslav429@gmail.com>
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

3 participants