Skip to content

Commit f2bc708

Browse files
authored
Change token to allow undefined return value (#342)
Unauthenticated users won't return a token.
1 parent 9704014 commit f2bc708

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

crates/bitwarden-wasm-internal/src/client.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub struct BitwardenClient(pub(crate) Client);
2121
impl BitwardenClient {
2222
#[allow(missing_docs)]
2323
#[wasm_bindgen(constructor)]
24-
pub fn new(settings: Option<ClientSettings>, token_provider: JsTokenProvider) -> Self {
24+
pub fn new(token_provider: JsTokenProvider, settings: Option<ClientSettings>) -> Self {
2525
let tokens = Arc::new(WasmClientManagedTokens::new(token_provider));
2626
Self(Client::new_with_client_tokens(settings, tokens))
2727
}

crates/bitwarden-wasm-internal/src/platform/token_provider.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use wasm_bindgen::{prelude::wasm_bindgen, JsValue};
55
#[wasm_bindgen(typescript_custom_section)]
66
const TOKEN_CUSTOM_TS_TYPE: &'static str = r#"
77
export interface TokenProvider {
8-
get_access_token(): Promise<string>;
8+
get_access_token(): Promise<string | undefined>;
99
}
1010
"#;
1111

0 commit comments

Comments
 (0)