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

Having trouble with authorization flow [windows] #35

Closed
moonstripe opened this issue Sep 7, 2023 · 6 comments
Closed

Having trouble with authorization flow [windows] #35

moonstripe opened this issue Sep 7, 2023 · 6 comments

Comments

@moonstripe
Copy link

I'm trying to reproduce some of the functions I have working on MacOS, but I'm getting the following error:

[2023-09-07T22:35:01Z WARN  rust_tdlib::client::worker] error received and possibly cannot be handled because of empty state receiver for client 1: Error { extra: Some("9317c4f9-99e0-499f-98e4-7eb076969d4f"), client_id: Some(1), code: 400, message: "Valid api_id must be provided. Can be obtained at https://my.telegram.org" }

Seems like the tdlib_params aren't being set properly, because when I set the verbosity level to 3, I see the following tdlib_params being sent:

[ 3][t 5][1694126101.514971256][Td.cpp:2966][#1][!Td][&td_requests]     Receive request 2: setTdlibParameters {
  use_test_dc = false
  database_directory = ""
  files_directory = ""
  database_encryption_key = bytes [0] { }
  use_file_database = false
  use_chat_info_database = false
  use_message_database = false
  use_secret_chats = false
  api_id = 0
  api_hash = ""
  system_language_code = ""
  device_model = ""
  system_version = ""
  application_version = ""
  enable_storage_optimizer = false
  ignore_file_names = false
}

Here's the code I'm using (essentially the same as on docs.rs):

    let mut worker = Worker::builder().build().unwrap();
    let waiter = worker.start();
    let tdlib_params = TdlibParameters::builder().api_id(var("API_ID").unwrap().parse::<i32>().unwrap()).api_hash(var("API_HASH").unwrap()).build();
    let client = rust_tdlib::client::Client::builder().with_tdlib_parameters(tdlib_params).build().unwrap();

    log::info!("Client {:#?}", client);

    log::info!("Worker {:#?}", worker);

    let client = worker.bind_client(client).await.unwrap();
    let me = client.get_me(GetMe::builder().build()).await.unwrap();
    println!("{:?}", me);

I've checked that the environmental variables are set and retrieved correctly.

@moonstripe
Copy link
Author

Perhaps it's an issue with my build of tdlib?

[ 3][t 5][1694126101.512905836][Td.cpp:4060][#1][!Td][&td_requests]     Sending update: updateOption {
  name = "version"
  value = optionValueString {
    value = "1.8.17"
  }
}

@antonio-antuan
Copy link
Owner

I'm not familiar with windows development. What if instead of passing it from environment variables you try to specify those parameters explicitly hardcoded in your code?

@moonstripe
Copy link
Author

Just tried it hard-coded. Same issue.

Looks like others have fixed it in the Python version by reverting it to 1.8.0?

tdlib/td#2285

@antonio-antuan
Copy link
Owner

I'd say yes the reason is that. Especially because the lib currently supports only 1.8.0 :)
I can provide support for a newer one, but I'm on vacation now and this is the first time in my life when I'm on vacation without laptop))
So I can dive into it not earlier than in a couple of weeks

@moonstripe
Copy link
Author

Hey hey, no rush! Hopefully reverting the build will help!

I'll update this issue if it works!

Thanks as always for your speedy responses!

@moonstripe
Copy link
Author

Works when I build the 1.8.0 version of TDLib!

Closing!

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