@microsoft/power-apps-native-auth 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +112 -0
- package/README.md +54 -0
- package/android/build.gradle +79 -0
- package/android/src/main/AndroidManifest.xml +31 -0
- package/android/src/main/java/expo/modules/msalintune/ExpoMsalIntuneModule.kt +488 -0
- package/app.plugin.js +4 -0
- package/expo-module.config.json +9 -0
- package/ios/ExpoMsalIntune.podspec +27 -0
- package/ios/ExpoMsalIntuneAppDelegate.swift +31 -0
- package/ios/ExpoMsalIntuneModule.swift +382 -0
- package/lib/NOTICE.txt +5 -0
- package/lib/commonjs/AuthConfig.types.js +1 -0
- package/lib/commonjs/ExpoMsalIntune.types.js +1 -0
- package/lib/commonjs/ExpoMsalIntuneModule.js +50 -0
- package/lib/commonjs/index.js +217 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/module/AuthConfig.types.js +1 -0
- package/lib/module/ExpoMsalIntune.types.js +1 -0
- package/lib/module/ExpoMsalIntuneModule.js +44 -0
- package/lib/module/index.js +207 -0
- package/lib/module/package.json +1 -0
- package/lib/typescript/commonjs/AuthConfig.types.d.ts +76 -0
- package/lib/typescript/commonjs/ExpoMsalIntune.types.d.ts +80 -0
- package/lib/typescript/commonjs/ExpoMsalIntuneModule.d.ts +92 -0
- package/lib/typescript/commonjs/index.d.ts +125 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/module/AuthConfig.types.d.ts +76 -0
- package/lib/typescript/module/ExpoMsalIntune.types.d.ts +80 -0
- package/lib/typescript/module/ExpoMsalIntuneModule.d.ts +92 -0
- package/lib/typescript/module/index.d.ts +125 -0
- package/lib/typescript/module/package.json +1 -0
- package/package.json +93 -0
- package/plugin/index.js +528 -0
- package/plugin/withMsalRedirectScheme.js +53 -0
- package/scripts/setup-android-sdk.js +122 -0
- package/scripts/setup-ios-frameworks.js +100 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
MICROSOFT SOFTWARE LICENSE TERMS
|
|
2
|
+
Power App Native Libraries
|
|
3
|
+
|
|
4
|
+
June 2026
|
|
5
|
+
These license terms are an agreement between you and Microsoft Corporation (or based
|
|
6
|
+
on where you live, one of its affiliates). They apply to the software named above. The terms
|
|
7
|
+
also apply to any Microsoft services or updates for the software, except to the extent those
|
|
8
|
+
have different terms.
|
|
9
|
+
|
|
10
|
+
IF YOU COMPLY WITH THESE LICENSE TERMS, YOU HAVE THE RIGHTS BELOW.
|
|
11
|
+
1. INSTALLATION AND USE RIGHTS.
|
|
12
|
+
a. This software is licensed as a supplement to Microsoft Power Platform (the “Product”).
|
|
13
|
+
Use of the software requires a valid license for the Product.
|
|
14
|
+
b. You may install and use any number of copies of the software to develop and test your
|
|
15
|
+
applications. It will be used as components to be leveraged by AI agents for creating
|
|
16
|
+
applications.
|
|
17
|
+
2. Third Party Components. The software may include third party components with
|
|
18
|
+
separate legal notices or governed by other agreements, as may be described in the
|
|
19
|
+
notices file(s) accompanying the software.
|
|
20
|
+
3. DATA.
|
|
21
|
+
a. Data Collection. The software may collect information about you and your use of the
|
|
22
|
+
software and send that to Microsoft. Microsoft may use this information to provide services
|
|
23
|
+
and improve our products and services. There are also some features in the software that
|
|
24
|
+
may enable you and Microsoft to collect data from users of your applications. If you use
|
|
25
|
+
these features, you must comply with applicable law, including providing appropriate
|
|
26
|
+
notices to users of your applications together with a copy of Microsoft’s privacy statement.
|
|
27
|
+
Our privacy statement is located at https://aka.ms/privacy. You can learn more about data
|
|
28
|
+
collection and its use from the software documentation and our privacy statement. Your
|
|
29
|
+
use of the software operates as your consent to these practices.
|
|
30
|
+
b. Processing of Personal Data. To the extent Microsoft is a processor or sub processor of
|
|
31
|
+
personal data in connection with the software, Microsoft makes the commitments in the
|
|
32
|
+
European Union General Data Protection Regulation Terms of the Microsoft Products and
|
|
33
|
+
Services Data Protection Addendum to all customers effective May 25, 2018, at
|
|
34
|
+
https://docs.microsoft.com/legal/gdpr.
|
|
35
|
+
4. SCOPE OF LICENSE. The software is licensed, not sold. These license terms only give
|
|
36
|
+
you some rights to use the software. Microsoft reserves all other rights. Unless applicable
|
|
37
|
+
law gives you more rights despite this limitation, you may use the software only as
|
|
38
|
+
expressly permitted in these license terms. In doing so, you must comply with any
|
|
39
|
+
technical limitations in the software that only allow you to use it in certain ways. In
|
|
40
|
+
addition, you may not:
|
|
41
|
+
• work around any technical limitations in the software;
|
|
42
|
+
• use it for any other purpose, other than designated in this license;
|
|
43
|
+
• reverse engineer, decompile or disassemble the software, or otherwise attempt to
|
|
44
|
+
derive the source code for the software, except and only to the extent required by
|
|
45
|
+
third party licensing terms governing use of certain open source components that
|
|
46
|
+
may be included with the software;
|
|
47
|
+
• remove, minimize, block or modify any notices of Microsoft or its suppliers in the
|
|
48
|
+
software;
|
|
49
|
+
• use the software in any way that is against the law;
|
|
50
|
+
• share, publish, rent, or lease the software; or
|
|
51
|
+
• provide the software as a stand-alone offering or combine it with any of your
|
|
52
|
+
applications for others to use, or transfer the software or this agreement to any third
|
|
53
|
+
party.
|
|
54
|
+
5. FEEDBACK. If you give feedback about the software to Microsoft, you give to Microsoft,
|
|
55
|
+
without charge, the right to use, share, and commercialize your feedback in any way and for
|
|
56
|
+
any purpose. You will not give feedback that is subject to a license that requires Microsoft
|
|
57
|
+
to license its software or documentation to third parties because we include your feedback
|
|
58
|
+
in them. These rights survive this agreement.
|
|
59
|
+
6. SUPPORT SERVICES. Because this software is “as is”, we may not provide support
|
|
60
|
+
services for it.
|
|
61
|
+
7. ENTIRE AGREEMENT. This agreement, and the terms for supplements, updates,
|
|
62
|
+
Internet-based services and support services, are the entire agreement for the software
|
|
63
|
+
and support services.
|
|
64
|
+
8. EXPORT RESTRICTIONS. You must comply with all domestic and international export
|
|
65
|
+
laws and regulations that apply to the software, which include restrictions on destinations,
|
|
66
|
+
end users, and end use. For further information on export restrictions, visit
|
|
67
|
+
https://www.microsoft.com/exporting.
|
|
68
|
+
9. APPLICABLE LAW. If you acquired the software in the United States, Washington state
|
|
69
|
+
law applies to interpretation of, and claims for breach of this agreement, and the laws of
|
|
70
|
+
the state where you live apply to all other claims. If you acquired the software in any other
|
|
71
|
+
country, its laws apply.
|
|
72
|
+
10. CONSUMER RIGHTS; REGIONAL VARIATIONS. These license terms describe certain
|
|
73
|
+
legal rights. You may have other rights, including consumer rights, under the laws of your
|
|
74
|
+
state or country. You may also have rights with respect to the party from which you
|
|
75
|
+
acquired the software. This agreement does not change those other rights if the laws of
|
|
76
|
+
your state or country do not permit it to do so. For example, if you acquired the software in
|
|
77
|
+
one of the below regions, or mandatory country law applies, then the following provisions
|
|
78
|
+
apply to you:
|
|
79
|
+
a. Australia. You have statutory guarantees under the Australian Consumer Law and
|
|
80
|
+
nothing in this agreement is intended to affect those rights.
|
|
81
|
+
b. Canada. You may stop receiving updates on your device by turning off Internet access. If
|
|
82
|
+
and when you re-connect to the Internet, the software will resume checking for and
|
|
83
|
+
installing updates.
|
|
84
|
+
c. Germany and Austria.
|
|
85
|
+
(i) Warranty. The properly licensed software will perform substantially as described in any
|
|
86
|
+
Microsoft materials that accompany the software. However, Microsoft gives no contractual
|
|
87
|
+
guarantee in relation to the licensed software.
|
|
88
|
+
(ii) Limitation of Liability. In case of intentional conduct, gross negligence, claims based
|
|
89
|
+
on the Product Liability Act, as well as, in the case of death or personal or physical injury,
|
|
90
|
+
Microsoft is liable according to the statutory law.
|
|
91
|
+
Subject to the preceding sentence (ii), Microsoft will only be liable for slight negligence if
|
|
92
|
+
Microsoft is in breach of such material contractual obligations, the fulfillment of which
|
|
93
|
+
facilitate the due performance of this agreement, the breach of which would endanger the
|
|
94
|
+
purpose of this agreement and the compliance with which a party may constantly trust in
|
|
95
|
+
(so-called "cardinal obligations"). In other cases of slight negligence, Microsoft will not be
|
|
96
|
+
liable for slight negligence.
|
|
97
|
+
11. DISCLAIMER OF WARRANTY. THE SOFTWARE IS LICENSED “AS-IS”. YOU BEAR THE
|
|
98
|
+
RISK OF USING IT. MICROSOFT GIVES NO EXPRESS WARRANTIES, GUARANTEES OR
|
|
99
|
+
CONDITIONS. TO THE EXTENT PERMITTED UNDER YOUR LOCAL LAWS, MICROSOFT
|
|
100
|
+
EXCLUDES THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
|
101
|
+
PARTICULAR PURPOSE AND NON-INFRINGEMENT.
|
|
102
|
+
12. LIMITATION ON AND EXCLUSION OF DAMAGES. YOU CAN RECOVER FROM
|
|
103
|
+
MICROSOFT AND ITS SUPPLIERS ONLY DIRECT DAMAGES UP TO U.S. $5.00. YOU
|
|
104
|
+
CANNOT RECOVER ANY OTHER DAMAGES, INCLUDING CONSEQUENTIAL, LOST
|
|
105
|
+
PROFITS, SPECIAL, INDIRECT OR INCIDENTAL DAMAGES.
|
|
106
|
+
This limitation applies to (a) anything related to the software, services, content (including
|
|
107
|
+
code) on third party Internet sites, or third party applications; and (b) claims for breach of
|
|
108
|
+
contract, breach of warranty, guarantee or condition, strict liability, negligence, or other tort
|
|
109
|
+
to the extent permitted by applicable law.
|
|
110
|
+
It also applies even if Microsoft knew or should have known about the possibility of the
|
|
111
|
+
damages. The above limitation or exclusion may not apply to you because your country
|
|
112
|
+
may not allow the exclusion or limitation of incidental, consequential or other damages.
|
package/README.md
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# @microsoft/power-apps-native-auth
|
|
2
|
+
|
|
3
|
+
Expo native module providing MSAL authentication and Microsoft Intune MAM
|
|
4
|
+
(Mobile Application Management) integration for iOS and Android React Native /
|
|
5
|
+
Expo applications.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm install @microsoft/power-apps-native-auth
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
After install, run the SDK setup to download the Microsoft Intune MAM SDK
|
|
14
|
+
binaries (not redistributed via npm — fetched from the official Microsoft
|
|
15
|
+
GitHub release at build time):
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
npm run setup --workspace @microsoft/power-apps-native-auth
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Peer dependencies
|
|
22
|
+
|
|
23
|
+
- `expo` >= 55.0.17
|
|
24
|
+
- `expo-modules-core` >= 55.0.23
|
|
25
|
+
- `react-native` >= 0.83.4
|
|
26
|
+
- `@expo/config-plugins` >= 55.0.8
|
|
27
|
+
|
|
28
|
+
## Usage
|
|
29
|
+
|
|
30
|
+
```ts
|
|
31
|
+
import { initializeFromConfig } from '@microsoft/power-apps-native-auth';
|
|
32
|
+
|
|
33
|
+
await initializeFromConfig({
|
|
34
|
+
clientId: '<your-msal-client-id>',
|
|
35
|
+
tenantId: '<your-tenant-id>',
|
|
36
|
+
});
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
See `src/index.ts` for the full exported API.
|
|
40
|
+
|
|
41
|
+
## Expo config plugin
|
|
42
|
+
|
|
43
|
+
This module ships an Expo config plugin that wires up the MSAL redirect URI
|
|
44
|
+
scheme. Add it to your `app.config.js` / `app.json`:
|
|
45
|
+
|
|
46
|
+
```js
|
|
47
|
+
{
|
|
48
|
+
"plugins": ["@microsoft/power-apps-native-auth"]
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## License
|
|
53
|
+
|
|
54
|
+
MIT — see [LICENSE](./LICENSE).
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
buildscript {
|
|
2
|
+
ext.kotlin_version = rootProject.ext.has('kotlinVersion') ? rootProject.ext.get('kotlinVersion') : '1.9.0'
|
|
3
|
+
repositories {
|
|
4
|
+
mavenCentral()
|
|
5
|
+
google()
|
|
6
|
+
}
|
|
7
|
+
dependencies {
|
|
8
|
+
classpath("com.android.tools.build:gradle:8.1.1")
|
|
9
|
+
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version")
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
apply plugin: 'com.android.library'
|
|
14
|
+
apply plugin: 'kotlin-android'
|
|
15
|
+
|
|
16
|
+
def safeExtGet(prop, fallback) {
|
|
17
|
+
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
android {
|
|
21
|
+
compileSdkVersion safeExtGet('compileSdkVersion', 35)
|
|
22
|
+
|
|
23
|
+
defaultConfig {
|
|
24
|
+
minSdkVersion safeExtGet('minSdkVersion', 26)
|
|
25
|
+
targetSdkVersion safeExtGet('targetSdkVersion', 35)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
compileOptions {
|
|
29
|
+
sourceCompatibility JavaVersion.VERSION_17
|
|
30
|
+
targetCompatibility JavaVersion.VERSION_17
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
kotlinOptions {
|
|
34
|
+
jvmTarget = "17"
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
namespace "expo.modules.msalintune"
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
repositories {
|
|
41
|
+
mavenCentral()
|
|
42
|
+
google()
|
|
43
|
+
// Microsoft Duo SDK feed — required by MSAL transitive dependencies
|
|
44
|
+
maven {
|
|
45
|
+
url "https://pkgs.dev.azure.com/MicrosoftDeviceSDK/DuoSDK-Public/_packaging/Duo-SDK-Feed/maven/v1"
|
|
46
|
+
}
|
|
47
|
+
// Intune MAM SDK is NOT published to any public Maven feed.
|
|
48
|
+
// Run `npm run setup:android` (from packages/expo-msal-intune/) to download
|
|
49
|
+
// the SDK AARs from GitHub into android/libs/ before building.
|
|
50
|
+
// The flatDir entry below makes Gradle resolve them as local file dependencies.
|
|
51
|
+
flatDir {
|
|
52
|
+
dirs 'libs'
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
dependencies {
|
|
57
|
+
implementation project(':expo-modules-core')
|
|
58
|
+
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
59
|
+
|
|
60
|
+
// MSAL Android — latest: 6.0.1 (com.microsoft.identity.client:msal on Maven Central)
|
|
61
|
+
implementation 'com.microsoft.identity.client:msal:6.+'
|
|
62
|
+
|
|
63
|
+
// Microsoft Intune MAM SDK for Android.
|
|
64
|
+
// NOT published to any public Maven feed — downloaded from GitHub by
|
|
65
|
+
// `npm run setup:android` (packages/expo-msal-intune/scripts/setup-android-sdk.js).
|
|
66
|
+
// Both the runtime AAR and the downlevel stubs AAR are required.
|
|
67
|
+
// The Gradle plugin jar (com.microsoft.intune.mam.build.jar) is referenced as
|
|
68
|
+
// a classpath dependency in templates/expo-app/android/build.gradle.
|
|
69
|
+
//
|
|
70
|
+
// Only linked in non-development-player builds. Development-player builds
|
|
71
|
+
// skip the download requirement entirely: Intune stays dormant
|
|
72
|
+
// (intune.enabled=false) so the SDK is unused even if the AAR were present.
|
|
73
|
+
if (!System.getenv('DEV_CLIENT') && !System.getenv('POWER_APPS_DEV_PLAYER')) {
|
|
74
|
+
// flatDir resolution: name:'Microsoft.Intune.MAM.SDK', ext:'aar'
|
|
75
|
+
// resolves to android/libs/Microsoft.Intune.MAM.SDK.aar
|
|
76
|
+
implementation(name: 'Microsoft.Intune.MAM.SDK', ext: 'aar')
|
|
77
|
+
implementation(name: 'Microsoft.Intune.MAM.SDK.DownlevelStubs', ext: 'aar')
|
|
78
|
+
}
|
|
79
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
|
2
|
+
<!--
|
|
3
|
+
MSAL on Android requires a BrowserTabActivity to receive the redirect.
|
|
4
|
+
Add the entry below to your *app's* AndroidManifest.xml, substituting
|
|
5
|
+
the correct values:
|
|
6
|
+
|
|
7
|
+
<activity android:name="com.microsoft.identity.client.BrowserTabActivity"
|
|
8
|
+
android:exported="true">
|
|
9
|
+
<intent-filter>
|
|
10
|
+
<action android:name="android.intent.action.VIEW" />
|
|
11
|
+
<category android:name="android.intent.category.DEFAULT" />
|
|
12
|
+
<category android:name="android.intent.category.BROWSABLE" />
|
|
13
|
+
<data
|
|
14
|
+
android:scheme="msauth"
|
|
15
|
+
android:host="<YOUR_PACKAGE_NAME>"
|
|
16
|
+
android:path="/<BASE64_URL_ENCODED_SIGNATURE_HASH>" />
|
|
17
|
+
</intent-filter>
|
|
18
|
+
</activity>
|
|
19
|
+
|
|
20
|
+
When using WEBVIEW mode (androidConfigOptions.authorization_user_agent = 'WEBVIEW')
|
|
21
|
+
this activity is NOT required.
|
|
22
|
+
|
|
23
|
+
The Intune SDK requires your Application class to extend MAMApplication:
|
|
24
|
+
|
|
25
|
+
class MainApplication : MAMApplication(), ReactApplication {
|
|
26
|
+
...
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
See: https://learn.microsoft.com/en-us/mem/intune/developer/app-sdk-android-phase4
|
|
30
|
+
-->
|
|
31
|
+
</manifest>
|