#panicked at 'time not implemented on this platform', library/std/src/sys/wasm/../unsupported/time.rs

7 messages · Page 1 of 1 (latest)

echo stump
#

Hi,
I'm having an error: panicked at 'time not implemented on this platform', library/std/src/sys/wasm/../unsupported/time.rs:31:9 while trying to implement the authentication flow using the openidconnect-rs crate,

let token_response_future = use_future(cx, (), |_| async move {
    token_response(client, auth_code).await
});
match token_response_future.value() {
    Some(token_response) => {
        let token_response_string =
            serde_json::to_string(token_response).unwrap();
        token_response_state.write().token_response =
            Some(token_response_string);
        nav.push(Route::Home {});
        rsx! { div { "Some token response has been decoded" } }
    }
    None => rsx! { div { "Signing in... Please wait" } },
}

The error specifically appears when I'm trying to write to the token_response state. My guess is that the openidconnect crate uses std::time and that makes the error appear. Another weird thing is that I'm redirected to the home page but the Some token response has been decoded still appears

#

Here is the full stacktrace:

panicked at 'time not implemented on this platform', library/std/src/sys/wasm/../unsupported/time.rs:31:9

Stack:

__wbg_get_imports/imports.wbg.__wbg_new_abda76e883ba8a5f/<@http://localhost:8000/assets/dioxus/DMP_FRONT.js:506:17
logError@http://localhost:8000/assets/dioxus/DMP_FRONT.js:252:18
__wbg_get_imports/imports.wbg.__wbg_new_abda76e883ba8a5f@http://localhost:8000/assets/dioxus/DMP_FRONT.js:505:62
console_error_panic_hook::Error::new::h0cf190ca9a01d901@http://localhost:8000/assets/dioxus/DMP_FRONT_bg.wasm:wasm-function[18118]:0x7104ad
console_error_panic_hook::hook_impl::hf97e470f22e18720@http://localhost:8000/assets/dioxus/DMP_FRONT_bg.wasm:wasm-function[3738]:0x4ccc26
console_error_panic_hook::hook::he9313a9f218f916d@http://localhost:8000/assets/dioxus/DMP_FRONT_bg.wasm:wasm-function[19896]:0x7285f1
core::ops::function::Fn::call::h9aaf1a7d1f13a4b1@http://localhost:8000/assets/dioxus/DMP_FRONT_bg.wasm:wasm-function[17173]:0x701726
std::panicking::rust_panic_with_hook::h7601402c…
DMP_FRONT.js:503:13
covert mountain
#

1- You might want to contact the author of openidconnect-rs to ask about wasm support
2- The fact that the error doesn't crash your app is due the error being thrown in another thread I think

echo stump
#

1- That's what I thought, but I read this comment: https://github.com/ramosbugs/openidconnect-rs/issues/126#issuecomment-1683035747 so I was just trying to make sure before asking, I also started to make a fork of the repos (openidconnect-rs and oauth2-rs) to attempt to replace all the occurences of std::time::* with their chrono counterpart, am I on the wrong path?

GitHub

I am trying to implement SSO for a leptos app I am making but I am stuck at the code exchange phase. I've tried a lot of things but am basically about to give up. I have the following code: asy...

#

The weird thing is that the error appears only when trying to write to the state, and not when I serialize the token or before that

echo stump