Using @capgo/capacitor-intune
The @capgo/capacitor-intune package brings Microsoft Intune MAM enrollment, app protection policies, app config, and MSAL authentication to Capacitor apps.
Use it to:
- sign users in with Microsoft using MSAL
- enroll the authenticated account into Intune MAM
- read Intune app configuration and policy values
- react to policy and app config refresh events
Installation
bun add @capgo/capacitor-intune
bunx cap sync
iOS Setup
This plugin bundles Intune iOS SDK 21.5.1, which means:
- iOS deployment target
17.0+ - current Xcode 26 compatibility
Add your IntuneMAMSettings dictionary to Info.plist, configure your msauth... redirect URI, forward the callback to MSALPublicClientApplication.handleMSALResponse(...), and run Microsoft's IntuneMAMConfigurator.
Android Setup
Add the Intune Gradle plugin, the Duo Maven feed, your auth_config.json, broker visibility queries, the BrowserTabActivity redirect filter, and either:
android:name="app.capgo.intune.IntuneApplication"- or your own
MAMApplicationsubclass that registersIntuneMamServiceAuthenticationCallback
Basic Usage
import { IntuneMAM } from '@capgo/capacitor-intune';
await IntuneMAM.addListener('policyChange', (result) => {
console.log('Policy changed', result.accountId);
});
const auth = await IntuneMAM.acquireToken({
scopes: ['https://graph.microsoft.com/.default'],
});
await IntuneMAM.registerAndEnrollAccount({
accountId: auth.accountId,
});
const user = await IntuneMAM.enrolledAccount();
const appConfig = await IntuneMAM.appConfig({ accountId: auth.accountId });
const policy = await IntuneMAM.getPolicy({ accountId: auth.accountId });
console.log({ user, appConfig, policy });
API Summary
acquireToken(options): interactive Microsoft sign-inacquireTokenSilent(options): silent token refreshregisterAndEnrollAccount(options): Intune registration and enrollmentappConfig(user): Intune app config payloadgetPolicy(user): Intune app protection policy payloadsdkVersion(): bundled Intune/MSAL versions