msal_js 2.14.0 copy "msal_js: ^2.14.0" to clipboard
msal_js: ^2.14.0 copied to clipboard

Platformweb

A Dart wrapper for the 'Microsoft Authentication Library for JavaScript (MSAL.js)'.

Pub Version

MSAL.js for Dart #

A Dart wrapper for the Microsoft Authentication Library for JavaScript (MSAL.js).

Note: This package wraps the MSAL.js 2.x (msal-browser) library. For 1.x (msal-core) support, please see the latest 1.x release of this package.

Contents #

Install MSAL.js #

This package is just a Dart wrapper and does not come with a build of MSAL.js. Please refer to the MSAL.js documentation for installation. Please note that you will need a CDN build of MSAL.js and not an NPM build.

Version Compatibility #

This package will match the version of MSAL.js which it supports up to the minor revision. For example, version 2.14.0 of this package supports MSAL.js 2.14.x. If MSAL.js increments its minor version without adding or changing its API surface, this package will not have a matching release since there's nothing to update. Additionally, this package may have patch releases that do not reflect the patch releases from MSAL.js.

Avoid using versions of MSAL.js older than versions of this package. APIs may be available in Dart that do not exist in the JavaScript API and can lead to runtime failures. Newer minor versions of MSAL.js should work fine since both libraries follow semantic versioning.

Usage #

Please see the various examples and sample applications for usage information in various scenarios such as:

Additionally, please see the official MSAL.js usage documentation. The examples and samples provided by this package do not cover everything, you will need to read the official MSAL.js documentation to fully understand how to use MSAL.

Class, function, and parameter names are almost all the same between this wrapper and MSAL.js (please see "Differences from MSAL.js" for more information). Following MSAL.js examples with Dart should be straight-forward.

Differences from MSAL.js #

This package has a few minor differences from the JavaScript and TypeScript APIs in MSAL.js. These are mainly due to incompatibilities between TypeScript and Dart and quality-of-life differences to provide a more idiomatic Dart API.

  • APIs returning JavaScript Promises instead return Dart Futures.
  • TypeScript string unions are represented as Dart enums.
  • MSAL errors are represented as Dart exceptions and use the suffix Exception instead of Error (e.g. AuthError in MSAL.js is AuthException in this wrapper).
  • Typescript interfaces are represented as a full Dart type. Instead of passing a map which meets the interface requirements, an actual type must be constructed (e.g. instead of loginPopup({scopes: []}) you would do loginPopup(PopupRequest()..scopes = [])).
  • PublicClientApplication.handleRedirectPromise was renamed to handleRedirectFuture since it does not return a promise in the Dart API.

Contributing #

Contributions to this package are more than welcome! If you have an immediate need for a new MSAL feature to be wrapped or for a bug to be fixed, please consider opening a pull request.

Please see our full contribution guide for more information.

21
likes
140
pub points
88%
popularity

Publisher

unverified uploader

A Dart wrapper for the 'Microsoft Authentication Library for JavaScript (MSAL.js)'.

Repository (GitHub)
View/report issues
Contributing

Documentation

API reference

License

MIT (license)

Dependencies

js

More

Packages that depend on msal_js