This is a plugin that only has a peer dependency to
piral-adal brings to the table is a direct integration with Azure Active Directory on basis of the MSAL library that can be used with
The set includes the
getAccessToken API to retrieve the current user's access token.
By default, these Pilet API extensions are not integrated in
piral, so you'd need to add them to your Piral instance.
The following functions are brought to the Pilet API.
Gets the currently authenticated user's token or
undefined if no user is authenticated.
For authors of pilets
You can use the
getAccessToken function from the Pilet API. This returns a promise.
Note that this value may change if the Piral instance supports an "on the fly" login (i.e., a login without redirect / reloading of the page).
Setup and Bootstrapping
For Piral instance developers
The provided library only brings API extensions for pilets to a Piral instance.
For the setup of the library itself you'll need to import
createAdalApi from the
The integration looks like:
The separation into
createAdalApi was done to simplify the standard usage.
Normally, you would want to have different modules here. As an example consider the following code:
// module adal.ts;;// app.ts;;// index.ts;if location.pathname !== '/auth'
This way we evaluate the current path and act accordingly. Note that the actually used path may be different for your application.
Piral is released using the MIT license. For more information see the license file.