msas v1.0.0
MSAS
A simple wrapper over msal.js to simplify development
It is intended to be used as a service.
The only function is useMsas
. This is a factory function that takes your authentication parameters as arguments and returns 3 functions:
login
logout
verifyAccount
Authentication is via popups, and token confirmation is silent (if an error occurs, the token will be confirmed with a popup).
Each function (except logout
) returns information about the user, which allows you to save it or use it to control the authorization process in the UI.
The verifyAccount
function tries to find information about the user in the browser's storage and, if successful, updates the token. In case of failure, the login function is called.
All exceptions are handled, which makes it possible to describe different cases. For example, handle the 401 error as you please.
NOTE: Multiple accounts are not supported
2 years ago