dermesser / yup-oauth2

An oauth2 client implementation providing the Device, Installed, Service Account, and several more flows.
https://docs.rs/yup-oauth2/
Apache License 2.0
219 stars 114 forks source link

Updating from 8.1 to 10.0: AuthenticatorBuilder panics with a CryptoProvider error #235

Closed jrconlin closed 3 months ago

jrconlin commented 3 months ago

Hi,

I'm getting the following error when updating from 8.1 to 10.0:

...
thread 'routers::fcm::client::tests::not_found' panicked at /home/jrconlin/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rustls-0.23.10/src/crypto/mod.rs:259:14:
no process-level CryptoProvider available -- call CryptoProvider::install_default() before this point
stack backtrace:
   0: rust_begin_unwind
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/panicking.rs:652:5
   1: core::panicking::panic_fmt
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/panicking.rs:72:14
   2: core::panicking::panic_display
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/panicking.rs:263:5
   3: core::option::expect_failed
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/option.rs:1994:5
   4: core::option::Option<T>::expect
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/option.rs:895:21
   5: rustls::crypto::CryptoProvider::get_default_or_install_from_crate_features
             at /home/jrconlin/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rustls-0.23.10/src/crypto/mod.rs:258:24
   6: rustls::client::client_conn::ClientConfig::builder_with_protocol_versions
             at /home/jrconlin/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rustls-0.23.10/src/client/client_conn.rs:294:13
   7: rustls::client::client_conn::ClientConfig::builder
             at /home/jrconlin/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rustls-0.23.10/src/client/client_conn.rs:271:9
   8: hyper_rustls::connector::builder::ConnectorBuilder<hyper_rustls::connector::builder::WantsTlsConfig>::with_native_roots
             at /home/jrconlin/.cargo/registry/src/index.crates.io-6f17d22bba15001f/hyper-rustls-0.27.2/src/connector/builder.rs:85:13
   9: <yup_oauth2::authenticator::DefaultHyperClient as yup_oauth2::authenticator::HyperClientBuilder>::build_hyper_client
             at /home/jrconlin/.cargo/registry/src/index.crates.io-6f17d22bba15001f/yup-oauth2-10.0.1/src/authenticator.rs:1006:25
  10: yup_oauth2::authenticator::AuthenticatorBuilder<C,F>::common_build::{{closure}}
             at /home/jrconlin/.cargo/registry/src/index.crates.io-6f17d22bba15001f/yup-oauth2-10.0.1/src/authenticator.rs:559:28
  11: yup_oauth2::authenticator::AuthenticatorBuilder<C,yup_oauth2::service_account::ServiceAccountFlowOpts>::build::{{closure}}
             at /home/jrconlin/.cargo/registry/src/index.crates.io-6f17d22bba15001f/yup-oauth2-10.0.1/src/authenticator.rs:774:10
...

My guess is that there's some missing config for RustTLS, or possibly some missing feature flag. I didn't see anything different in the README, and there doesn't appear to be any changes in the features set. Is there somewhere I can look to see what I need to do differently between these versions?

I note that the [latest tag in this repo is 8.1}(https://github.com/dermesser/yup-oauth2/tags), crates.io reports the latest version is 10.0, I'm guessing you've possibly forgotten to tag some releases? Thanks

threema-donat commented 3 months ago

AFAIK The fix is already merged, but there's no release as for now. There's already an issue for this here. To resolve this issue, you could use a git dependency instead.

threema-donat commented 3 months ago

The release with the tag 11.0.0 should resolve this issue