Rust wrapper for msal-browser.js. Still under dev, but you can login, get tokens and logout.
Methods names all match the js
but with snake case, but unlike the js
that exposes all methods on a PublicClientApplication
type there are two app types:
PopupApp
RedirectApp
The PopupApp
is a the default feature: if you want to use the RedirectApp
it is behind the redirect
feature:
rust
msal_browser = { version = "0.1.2", features = ["redirect"] }
There are a huge amount of Configuration
so the rust side uses a builder pattern.
(You can also use a js Object
and call Configuration::TryFrom<Object> / Into
... however note that if the fields aren't yet on the builder they won't get added)
To use:
```rust const CLIENTID: &str = "YOURCLIENTID"; const AUTHORITY: &str = "YOURAUTHORITY";
// Setup App and build let authoptions = BrowserAuthOptions::from(CLIENTID).setauthority(AUTHORITY); let config = Configuration::from(authoptions); let client_app = PopupApp::new(config);
// Login let authres = clientapp.login_popup().await.unwrap();
```