Rust + WASM + msal-browser

Rust wrapper for msal-browser.js. Still under dev, but you can login, get tokens and logout.

Approx file sizes in kb:

| File | Debug | Release | Release + minified | --- | --- | --- | --- | | wasm | 63 | 14 | 14 | js | 363 | 363 | 113

The js file bundles the msal-browser.js library.

Methods names all match the js but with snake case, but unlike the js instead of a single PublicClientApplication type there are two app types:

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", features = ["redirect"] }

There are a huge amount of Configuration options so the rust side uses a builder pattern. You can also use a js Object and call Configuration::TryFrom<Object>.

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);

let scopes = ["User.Read"];

// Login let authres = clientapp.login_popup().await.unwrap();

// Get account let account = &clientapp.getall_accounts().unwrap()[0];

// Setup some requests let baserequest = BaseAuthRequest::from(&scopes[..]); let authrequest = AuthorizationUrlRequest::from(&baserequest).setloginhint(account.username()); let silentrequest = SilentRequest::fromaccountinfo(&base_request, account);

// SSO sign in let ssoauthresult = clientapp.ssosilent(&auth_request).await.unwrap();

// Popup token let token = clientapp.acquiretokenpopup(&authrequest).await.unwrap();

// Silent token let silenttoken = clientapp.acquiretokensilent(&silent_request).await.unwrap();

// Logout client_app.logout(None); ```