react-native-msal2 1.0.16 → 1.0.18

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/README.md CHANGED
@@ -1,94 +1,456 @@
1
1
  # react-native-msal2
2
2
 
3
-
4
3
  [![npm latest version](https://img.shields.io/npm/v/react-native-msal2/latest.svg)](https://www.npmjs.com/package/react-native-msal2)
5
- [![npm beta version](https://img.shields.io/npm/v/react-native-msal2/beta.svg)](https://www.npmjs.com/package/react-native-msal2)
6
4
  [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
7
5
 
8
- MSAL React Native wrapper for iOS and Android
6
+ A React Native wrapper around Microsoft Authentication Library (MSAL) for iOS and Android. Enables authentication with Microsoft identity platform (Azure AD, Azure AD B2C, Microsoft personal accounts) in your React Native apps.
7
+
8
+ ## Table of Contents
9
+
10
+ - [Features](#features)
11
+ - [Prerequisites](#prerequisites)
12
+ - [Installation](#installation)
13
+ - [Platform Setup](#platform-setup)
14
+ - [iOS Setup](#ios-setup)
15
+ - [Android Setup](#android-setup)
16
+ - [Usage](#usage)
17
+ - [Configuration](#configuration)
18
+ - [Initialization](#initialization)
19
+ - [Acquire Token Interactively](#acquire-token-interactively)
20
+ - [Acquire Token Silently](#acquire-token-silently)
21
+ - [Get Accounts](#get-accounts)
22
+ - [Remove Account / Sign Out](#remove-account--sign-out)
23
+ - [API Reference](#api-reference)
24
+ - [PublicClientApplication](#publicclientapplication)
25
+ - [Types](#types)
26
+ - [B2C Example](#b2c-example)
27
+ - [Troubleshooting](#troubleshooting)
28
+ - [Development](#development)
29
+ - [License](#license)
30
+
31
+ ## Features
32
+
33
+ - Interactive and silent token acquisition
34
+ - Azure AD and Azure AD B2C support
35
+ - Multiple account management
36
+ - Customizable webview parameters (iOS)
37
+ - Android Custom Tabs browser configuration
38
+ - TypeScript support out of the box
39
+
40
+ ## Prerequisites
41
+
42
+ - React Native >= 0.70
43
+ - iOS >= 12.0
44
+ - Android minSdkVersion >= 21
45
+ - An app registered in the [Azure Portal](https://portal.azure.com/#blade/Microsoft_AAD_RegisteredApps/ApplicationsListBlade)
9
46
 
10
47
  ## Installation
11
48
 
49
+ ```bash
50
+ npm install react-native-msal2
51
+ ```
52
+
53
+ ### iOS
54
+
55
+ ```bash
56
+ cd ios && pod install
57
+ ```
58
+
59
+ ### Android
60
+
61
+ No additional install steps required — autolinking handles it.
62
+
63
+ ## Platform Setup
64
+
65
+ ### iOS Setup
66
+
67
+ #### 1. Register a Redirect URI
68
+
69
+ In the Azure Portal, add a redirect URI for iOS:
70
+
71
+ ```
72
+ msauth.<your.bundle.id>://auth
73
+ ```
74
+
75
+ #### 2. Configure URL Scheme
76
+
77
+ Add the following to your `Info.plist`:
78
+
79
+ ```xml
80
+ <key>CFBundleURLTypes</key>
81
+ <array>
82
+ <dict>
83
+ <key>CFBundleURLSchemes</key>
84
+ <array>
85
+ <string>msauth.$(PRODUCT_BUNDLE_IDENTIFIER)</string>
86
+ </array>
87
+ </dict>
88
+ </array>
89
+ ```
90
+
91
+ #### 3. Handle Auth Redirects
92
+
93
+ In your `AppDelegate.m` (or `AppDelegate.mm`), add:
94
+
95
+ ```objc
96
+ #import <MSAL/MSAL.h>
97
+
98
+ - (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options
99
+ {
100
+ return [MSALPublicClientApplication handleMSALResponse:url sourceApplication:options[UIApplicationOpenURLOptionsSourceApplicationKey]];
101
+ }
102
+ ```
103
+
104
+ #### 4. Keychain Sharing (Optional)
105
+
106
+ If you need keychain sharing, add the `Keychain Sharing` capability in Xcode and add your bundle identifier as a keychain group.
107
+
108
+ ### Android Setup
109
+
110
+ #### 1. Register a Redirect URI
111
+
112
+ The library automatically generates a redirect URI in the format:
113
+
12
114
  ```
13
- npm i react-native-msal2
115
+ msauth://<your.package.name>/<base64-encoded-signature-hash>
14
116
  ```
15
117
 
118
+ You can also provide a custom `redirectUri` in the config. Register whichever URI you use in the Azure Portal.
119
+
120
+ #### 2. Configure BrowserTabActivity
121
+
122
+ Add the following activity to your `AndroidManifest.xml` inside the `<application>` tag:
123
+
124
+ ```xml
125
+ <activity android:name="com.microsoft.identity.client.BrowserTabActivity">
126
+ <intent-filter>
127
+ <action android:name="android.intent.action.VIEW" />
128
+ <category android:name="android.intent.category.DEFAULT" />
129
+ <category android:name="android.intent.category.BROWSABLE" />
130
+ <data
131
+ android:scheme="msauth"
132
+ android:host="<your.package.name>"
133
+ android:path="/<url-encoded-signature-hash>" />
134
+ </intent-filter>
135
+ </activity>
136
+ ```
137
+
138
+ #### 3. Get Your Signature Hash
139
+
140
+ To find your signature hash for the redirect URI:
141
+
142
+ ```bash
143
+ keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | openssl sha1 -binary | openssl base64
144
+ ```
145
+
146
+ Default debug keystore password is `android`.
147
+
16
148
  ## Usage
17
149
 
150
+ ### Configuration
151
+
18
152
  ```typescript
19
153
  import PublicClientApplication from 'react-native-msal2';
20
- import type { MSALConfiguration /*, etc */ } from 'react-native-msal2';
154
+ import type { MSALConfiguration } from 'react-native-msal2';
155
+ import { Platform } from 'react-native';
21
156
 
22
157
  const config: MSALConfiguration = {
23
158
  auth: {
24
- clientId: 'your-client-id',
25
- // This authority is used as the default in `acquireToken` and `acquireTokenSilent` if not provided to those methods.
159
+ clientId: '<your-client-id>',
26
160
  // Defaults to 'https://login.microsoftonline.com/common'
27
- authority: 'https://<authority url>',
161
+ authority: 'https://login.microsoftonline.com/<tenant-id>',
162
+ knownAuthorities: ['https://login.microsoftonline.com/<tenant-id>'],
163
+ redirectUri: Platform.select({
164
+ ios: 'msauth.<your.bundle.id>://auth',
165
+ android: 'msauth://<your.package.name>/<signature-hash>',
166
+ }),
167
+ },
168
+ // Android-specific options (optional)
169
+ androidConfigOptions: {
170
+ authorization_user_agent: 'DEFAULT',
171
+ broker_redirect_uri_registered: false,
172
+ logging: {
173
+ pii_enabled: false,
174
+ log_level: 'ERROR',
175
+ logcat_enabled: true,
176
+ },
28
177
  },
29
178
  };
30
- const scopes = ['scope1', 'scope2'];
179
+ ```
180
+
181
+ ### Initialization
31
182
 
32
- // Initialize the public client application:
183
+ You must call `init()` before using any other method:
184
+
185
+ ```typescript
33
186
  const pca = new PublicClientApplication(config);
187
+
34
188
  try {
35
189
  await pca.init();
36
190
  } catch (error) {
37
- console.error('Error initializing the pca, check your config.', error);
191
+ console.error('Error initializing MSAL:', error);
38
192
  }
193
+ ```
194
+
195
+ ### Acquire Token Interactively
196
+
197
+ Use this for the first-time login or when a silent token acquisition fails:
198
+
199
+ ```typescript
200
+ import type { MSALInteractiveParams, MSALResult } from 'react-native-msal2';
201
+
202
+ const params: MSALInteractiveParams = {
203
+ scopes: ['User.Read'],
204
+ promptType: MSALPromptType.SELECT_ACCOUNT,
205
+ loginHint: '<email>',
206
+ };
39
207
 
40
- // Acquiring a token for the first time, you must call pca.acquireToken
41
- const params: MSALInteractiveParams = { scopes };
42
208
  const result: MSALResult | undefined = await pca.acquireToken(params);
209
+ console.log('Access token:', result?.accessToken);
210
+ ```
211
+
212
+ ### Acquire Token Silently
213
+
214
+ Use this for subsequent token acquisitions using a cached account:
215
+
216
+ ```typescript
217
+ import type { MSALSilentParams } from 'react-native-msal2';
43
218
 
44
- // On subsequent token acquisitions, you can call `pca.acquireTokenSilent`
45
- // Force the token to refresh with the `forceRefresh` option
46
219
  const params: MSALSilentParams = {
47
- account: result!.account, // or get this by filtering the result from `pca.getAccounts` (see below)
48
- scopes,
49
- forceRefresh: true,
220
+ scopes: ['User.Read'],
221
+ account: result!.account,
222
+ forceRefresh: false,
50
223
  };
51
- const result: MSALResult | undefined = await pca.acquireTokenSilent(params);
52
224
 
53
- // Get all accounts for which this application has refresh tokens
54
- const accounts: MSALAccount[] = await pca.getAccounts();
225
+ const silentResult = await pca.acquireTokenSilent(params);
226
+ ```
55
227
 
56
- // Retrieve the account matching the identifier
57
- const account: MSALAccount | undefined = await pca.getAccount(result!.account.identifier);
228
+ ### Get Accounts
58
229
 
59
- // Remove all tokens from the cache for this application for the provided account
60
- const success: boolean = await pca.removeAccount(result!.account);
230
+ ```typescript
231
+ // Get all accounts with cached refresh tokens
232
+ const accounts = await pca.getAccounts();
61
233
 
62
- // Same as `pca.removeAccount` with the exception that, if called on iOS with the `signoutFromBrowser` option set to true, it will additionally remove the account from the system browser
63
- const params: MSALSignoutParams = {
64
- account: result!.account,
234
+ // Get a specific account by identifier
235
+ const account = await pca.getAccount(accountIdentifier);
236
+ ```
237
+
238
+ ### Remove Account / Sign Out
239
+
240
+ ```typescript
241
+ // Remove account from cache (works on both platforms)
242
+ await pca.removeAccount(account);
243
+
244
+ // Sign out with browser session cleanup (iOS only — falls back to removeAccount on Android)
245
+ import type { MSALSignoutParams } from 'react-native-msal2';
246
+
247
+ await pca.signOut({
248
+ account,
65
249
  signoutFromBrowser: true,
250
+ });
251
+ ```
252
+
253
+ ## API Reference
254
+
255
+ ### PublicClientApplication
256
+
257
+ | Method | Returns | Description |
258
+ |---|---|---|
259
+ | `init()` | `Promise<this>` | Initializes the native MSAL client. Must be called first. |
260
+ | `acquireToken(params)` | `Promise<MSALResult \| undefined>` | Acquires a token interactively via a webview/browser. |
261
+ | `acquireTokenSilent(params)` | `Promise<MSALResult \| undefined>` | Acquires a token silently from cache or by refreshing. |
262
+ | `getAccounts()` | `Promise<MSALAccount[]>` | Returns all accounts with cached refresh tokens. |
263
+ | `getAccount(identifier)` | `Promise<MSALAccount \| undefined>` | Returns the account matching the given identifier. |
264
+ | `removeAccount(account)` | `Promise<boolean>` | Removes all cached tokens for the given account. |
265
+ | `signOut(params)` | `Promise<boolean>` | Removes cached tokens and optionally signs out from the browser (iOS). |
266
+ | `getSelectedBrowser()` | `Promise<string>` | Returns the browser used for auth. Android only (returns `'N/A'` on iOS). |
267
+ | `getSafeCustomTabsBrowsers()` | `Promise<MSALAndroidPreferredBrowser[]>` | Returns installed browsers supporting Custom Tabs. Android only. |
268
+
269
+ ### Types
270
+
271
+ #### MSALConfiguration
272
+
273
+ ```typescript
274
+ interface MSALConfiguration {
275
+ auth: {
276
+ clientId: string;
277
+ authority?: string; // Default: 'https://login.microsoftonline.com/common'
278
+ knownAuthorities?: string[];
279
+ redirectUri?: string; // Platform-specific, auto-generated on Android if omitted
280
+ };
281
+ androidConfigOptions?: MSALAndroidConfigOptions;
282
+ }
283
+ ```
284
+
285
+ #### MSALInteractiveParams
286
+
287
+ ```typescript
288
+ interface MSALInteractiveParams {
289
+ scopes: string[];
290
+ authority?: string;
291
+ promptType?: MSALPromptType;
292
+ loginHint?: string;
293
+ extraQueryParameters?: Record<string, string>;
294
+ extraScopesToConsent?: string[];
295
+ webviewParameters?: MSALWebviewParams;
296
+ }
297
+ ```
298
+
299
+ #### MSALSilentParams
300
+
301
+ ```typescript
302
+ interface MSALSilentParams {
303
+ scopes: string[];
304
+ account: MSALAccount;
305
+ authority?: string;
306
+ forceRefresh?: boolean;
307
+ }
308
+ ```
309
+
310
+ #### MSALSignoutParams
311
+
312
+ ```typescript
313
+ interface MSALSignoutParams {
314
+ account: MSALAccount;
315
+ signoutFromBrowser?: boolean; // iOS only, default: false
316
+ webviewParameters?: MSALWebviewParams;
317
+ }
318
+ ```
319
+
320
+ #### MSALResult
321
+
322
+ ```typescript
323
+ interface MSALResult {
324
+ accessToken: string;
325
+ account: MSALAccount;
326
+ expiresOn: number; // Unix timestamp (seconds)
327
+ idToken?: string;
328
+ scopes: string[];
329
+ tenantId?: string;
330
+ }
331
+ ```
332
+
333
+ #### MSALAccount
334
+
335
+ ```typescript
336
+ interface MSALAccount {
337
+ identifier: string;
338
+ environment?: string;
339
+ tenantId: string;
340
+ username: string;
341
+ claims?: object;
342
+ }
343
+ ```
344
+
345
+ #### MSALPromptType
346
+
347
+ ```typescript
348
+ enum MSALPromptType {
349
+ SELECT_ACCOUNT = 0,
350
+ LOGIN = 1,
351
+ CONSENT = 2,
352
+ WHEN_REQUIRED = 3,
353
+ DEFAULT = WHEN_REQUIRED,
354
+ }
355
+ ```
356
+
357
+ #### MSALWebviewParams (iOS)
358
+
359
+ ```typescript
360
+ interface MSALWebviewParams {
361
+ ios_prefersEphemeralWebBrowserSession?: boolean; // iOS 13+
362
+ ios_webviewType?: Ios_MSALWebviewType;
363
+ ios_presentationStyle?: Ios_ModalPresentationStyle;
364
+ }
365
+ ```
366
+
367
+ #### MSALAndroidConfigOptions
368
+
369
+ ```typescript
370
+ interface MSALAndroidConfigOptions {
371
+ authorization_user_agent?: 'DEFAULT' | 'BROWSER' | 'WEBVIEW';
372
+ broker_redirect_uri_registered?: boolean;
373
+ preferred_browser?: MSALAndroidPreferredBrowser;
374
+ browser_safelist?: {
375
+ browser_package_name: string;
376
+ browser_signature_hashes: string[];
377
+ browser_use_customTab: boolean;
378
+ }[];
379
+ http?: { connect_timeout?: number; read_timeout?: number };
380
+ logging?: {
381
+ pii_enabled?: boolean;
382
+ log_level?: 'ERROR' | 'WARNING' | 'INFO' | 'VERBOSE';
383
+ logcat_enabled?: boolean;
384
+ };
385
+ multiple_clouds_supported?: boolean;
386
+ }
387
+ ```
388
+
389
+ ## B2C Example
390
+
391
+ ```typescript
392
+ import PublicClientApplication, {
393
+ MSALConfiguration,
394
+ MSALInteractiveParams,
395
+ } from 'react-native-msal2';
396
+
397
+ const b2cConfig: MSALConfiguration = {
398
+ auth: {
399
+ clientId: '<your-client-id>',
400
+ authority: 'https://<tenant>.b2clogin.com/tfp/<tenant>.onmicrosoft.com/<sign-in-policy>',
401
+ knownAuthorities: ['https://<tenant>.b2clogin.com'],
402
+ },
66
403
  };
67
- const success: boolean = await pca.signOut(params);
404
+
405
+ const pca = new PublicClientApplication(b2cConfig);
406
+ await pca.init();
407
+
408
+ const result = await pca.acquireToken({
409
+ scopes: ['https://<tenant>.onmicrosoft.com/<api-id>/access_as_user'],
410
+ });
68
411
  ```
69
412
 
413
+ ## Troubleshooting
414
+
415
+ - **"PublicClientApplication is not initialized"** — Ensure you call `await pca.init()` before any other method.
416
+ - **iOS redirect issues** — Verify your URL scheme in `Info.plist` matches the redirect URI registered in Azure Portal, and that `AppDelegate` handles the MSAL response.
417
+ - **Android signature hash mismatch** — Regenerate your signature hash and ensure it matches the redirect URI in Azure Portal. Debug and release builds use different keystores.
418
+ - **B2C authority not recognized** — Make sure the authority URL follows the pattern `https://<tenant>.b2clogin.com/tfp/<tenant>.onmicrosoft.com/<policy>` and is included in `knownAuthorities`.
419
+ - **Silent token acquisition fails** — The refresh token may have expired. Fall back to `acquireToken` (interactive) and catch the error from `acquireTokenSilent`.
420
+
70
421
  ## Development
71
422
 
72
423
  ### Build
73
424
 
74
- Run a single build with `npm run build` and find the output in `/dist`.
425
+ ```bash
426
+ npm run build
427
+ ```
428
+
429
+ Output is in `/dist`.
75
430
 
76
431
  ### Tests
77
432
 
78
- Tests configured for React Native can be run with `npm test` or `npm run test:watch` in watch mode.
433
+ ```bash
434
+ npm test
435
+ npm run test:watch # watch mode
436
+ ```
79
437
 
80
438
  ### Preview App
81
439
 
82
- To test your plugin on a device run the following to create a React Native app using it.
440
+ Create a test app and run it on a device:
83
441
 
84
- ```
442
+ ```bash
85
443
  npm run app
86
444
  cd app
87
- npm run ios / npm run android
445
+ npm run ios # or npm run android
88
446
  ```
89
447
 
90
- The following command will automatically copy over changes made to the plugin to the app.
448
+ Auto-copy plugin changes to the app:
91
449
 
92
- ```
450
+ ```bash
93
451
  npm run watch
94
452
  ```
453
+
454
+ ## License
455
+
456
+ MIT
@@ -175,6 +175,16 @@ class RNMSALModule(reactContext: ReactApplicationContext?) :
175
175
  }
176
176
 
177
177
  val packageInfo = getPackageInfoCompat(pm, packageName) ?: continue
178
+
179
+ // Guard against null signing info which causes NPE in PackageHelper.generateSignatureHashes
180
+ val hasSigningInfo = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
181
+ packageInfo.signingInfo != null
182
+ } else {
183
+ @Suppress("DEPRECATION")
184
+ packageInfo.signatures != null
185
+ }
186
+ if (!hasSigningInfo) continue
187
+
178
188
  val version = packageInfo.versionName
179
189
  ?: if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
180
190
  packageInfo.longVersionCode.toString()
package/dist/index.js CHANGED
@@ -51,7 +51,7 @@ var PublicClientApplication = class {
51
51
  async getSafeCustomTabsBrowsers() {
52
52
  this.validateIsInitialized();
53
53
  return await Platform.select({
54
- android: async () => [await RNMSAL.getSafeCustomTabsBrowsers()],
54
+ android: async () => await RNMSAL.getSafeCustomTabsBrowsers(),
55
55
  default: async () => []
56
56
  })();
57
57
  }
package/dist/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/publicClientApplication.ts", "../src/types.ts", "../index.tsx"],
4
- "sourcesContent": ["import { Platform } from 'react-native'\n\nimport type {\n MSALConfiguration,\n MSALInteractiveParams,\n MSALSilentParams,\n MSALAccount,\n MSALSignoutParams,\n IPublicClientApplication,\n MSALResult,\n MSALAndroidPreferredBrowser,\n} from './types'\n\nimport { NativeModules } from 'react-native'\n\ntype RNMSALNativeModule = {\n createPublicClientApplication(config: MSALConfiguration): Promise<void>\n acquireToken(params: MSALInteractiveParams): Promise<MSALResult | undefined>\n acquireTokenSilent(params: MSALSilentParams): Promise<MSALResult | undefined>\n getAccounts(): Promise<MSALAccount[]>\n getAccount(accountIdentifier: string): Promise<MSALAccount | undefined>\n removeAccount(account: MSALAccount): Promise<boolean>\n signout(params: MSALSignoutParams): Promise<boolean>\n getSelectedBrowser(): Promise<string>\n getSafeCustomTabsBrowsers(): Promise<MSALAndroidPreferredBrowser>\n}\n\nconst RNMSAL: RNMSALNativeModule = NativeModules.RNMSAL\n\n// export default RNMSAL\n\nexport class PublicClientApplication implements IPublicClientApplication {\n private isInitialized: boolean = false\n\n constructor(private readonly config: MSALConfiguration) {}\n\n public async init() {\n if (!this.isInitialized) {\n await RNMSAL.createPublicClientApplication(this.config)\n this.isInitialized = true\n }\n return this\n }\n\n public async acquireToken(params: MSALInteractiveParams) {\n this.validateIsInitialized()\n return await RNMSAL.acquireToken(params)\n }\n\n public async acquireTokenSilent(params: MSALSilentParams) {\n this.validateIsInitialized()\n return await RNMSAL.acquireTokenSilent(params)\n }\n\n public async getAccounts() {\n this.validateIsInitialized()\n return await RNMSAL.getAccounts()\n }\n\n public async getAccount(accountIdentifier: string) {\n this.validateIsInitialized()\n return await RNMSAL.getAccount(accountIdentifier)\n }\n\n public async removeAccount(account: MSALAccount) {\n this.validateIsInitialized()\n return await RNMSAL.removeAccount(account)\n }\n\n public async signOut(params: MSALSignoutParams) {\n this.validateIsInitialized()\n return await Platform.select({\n ios: async () => await RNMSAL.signout(params),\n default: async () => await RNMSAL.removeAccount(params.account),\n })()\n }\n\n public async getSelectedBrowser() {\n this.validateIsInitialized()\n return await Platform.select({\n android: async () => await RNMSAL.getSelectedBrowser(),\n default: async () => 'N/A',\n })()\n }\n\n async getSafeCustomTabsBrowsers() {\n this.validateIsInitialized()\n return await Platform.select({\n android: async () => [await RNMSAL.getSafeCustomTabsBrowsers()],\n default: async () => [],\n })()\n }\n\n private validateIsInitialized() {\n if (!this.isInitialized) {\n throw new Error(\n 'PublicClientApplication is not initialized. You must call the `init` method before any other method.',\n )\n }\n }\n}\n", "export interface IPublicClientApplication {\n /**\n * Acquire a token interactively\n * @param {MSALInteractiveParams} params\n * @return Result containing an access token and account identifier\n * used for acquiring subsequent tokens silently\n */\n acquireToken(params: MSALInteractiveParams): Promise<MSALResult | undefined>\n\n /**\n * Acquire a token silently\n * @param {MSALSilentParams} params - Includes the account identifer retrieved from a\n * previous interactive login\n * @return Result containing an access token and account identifier\n * used for acquiring subsequent tokens silently\n */\n acquireTokenSilent(params: MSALSilentParams): Promise<MSALResult | undefined>\n\n /**\n * Get all accounts for which this application has refresh tokens\n * @return Promise containing array of MSALAccount objects for which this application\n * has refresh tokens.\n */\n getAccounts(): Promise<MSALAccount[]>\n\n /**\n * Retrieve the account matching the identifier\n * @return Promise containing MSALAccount object\n */\n getAccount(accountIdentifier: string): Promise<MSALAccount | undefined>\n\n /**\n * Removes all tokens from the cache for this application for the provided\n * account.\n * @param {MSALAccount} account\n * @return A promise containing a boolean = true if account removal was successful\n * otherwise rejects\n */\n removeAccount(account: MSALAccount): Promise<boolean>\n\n /**\n * Removes all tokens from the cache for this application for the provided\n * account. Additionally, this will remove the account from the system browser.\n * NOTE: iOS only. On Android and web this is the same as `removeAccount`.\n * @param {MSALSignoutParams} params\n * @return A promise which resolves if sign out is successful,\n * otherwise rejects\n * @platform ios\n */\n signOut(params: MSALSignoutParams): Promise<boolean>\n\n /**\n * Returns the browser that will be used for interactive authentication.\n * NOTE: Android only. On iOS this will always return 'N/A'.\n * @return Promise resolving to the package name and version of the browser that will be used\n * for interactive authentication.\n * @platform android\n */\n getSelectedBrowser(): Promise<string>\n\n /**\n * Returns a array of installed browsers found in the configured safe list that support customTab.\n * NOTE: Android only. On iOS this will always return N/A.\n * @return Promise resolving to an array of installed browsers that support customTab\n * @platform android\n */\n getSafeCustomTabsBrowsers(): Promise<MSALAndroidPreferredBrowser[]>\n}\n\nexport interface MSALConfiguration {\n auth: {\n /**\n * The client ID of the application, this should come from the app developer portal.\n */\n clientId: string\n /**\n * The authority the application will use to obtain tokens.\n */\n authority?: string\n /**\n * List of known authorities that the application should trust.\n */\n knownAuthorities?: string[]\n /**\n * The redirect URI of the application.\n *\n * If you are providing this property, you should probably use `Platform.select`,\n * because the redirect uris will be different for each platform.\n */\n redirectUri?: string\n }\n /**\n * Options as described here: {@link https://docs.microsoft.com/en-us/azure/active-directory/develop/msal-configuration}\n * @platform android\n */\n androidConfigOptions?: MSALAndroidConfigOptions\n}\n\nexport interface MSALAndroidPreferredBrowser {\n browser_package_name: string;\n browser_signature_hashes: string[];\n browser_version_lower_bound?: string;\n browser_version_upper_bound?: string;\n}\n\nexport interface MSALAndroidConfigOptions {\n authorization_user_agent?: 'DEFAULT' | 'BROWSER' | 'WEBVIEW'\n broker_redirect_uri_registered?: boolean\n preferred_browser?: MSALAndroidPreferredBrowser;\n browser_safelist?: {\n browser_package_name: string\n browser_signature_hashes: string[]\n browser_use_customTab: boolean\n }[]\n http?: {\n connect_timeout?: number\n read_timeout?: number\n }\n logging?: {\n pii_enabled?: boolean\n log_level?: 'ERROR' | 'WARNING' | 'INFO' | 'VERBOSE'\n logcat_enabled?: boolean\n }\n multiple_clouds_supported?: boolean\n}\n\nexport interface MSALInteractiveParams {\n /**\n * Permissions you want included in the access token received in the result.\n * Not all scopes are guaranteed to be included in the access token returned.\n */\n scopes: string[]\n /**\n * The authority that MSAL will use to obtain tokens. If not included, authority from\n * MSALConfiguration will be used.\n */\n authority?: string\n /**\n * A specific prompt type for the interactive authentication flow.\n */\n promptType?: MSALPromptType\n /**\n * A loginHint (usually an email) to pass to the service at the beginning of the\n * interactive authentication flow. The account returned is not guaranteed to match\n * the loginHint.\n */\n loginHint?: string\n /**\n * Key-value pairs to pass to the /authorize and /token endpoints.\n */\n extraQueryParameters?: Record<string, string>\n /**\n * Permissions you want the account to consent to in the same authentication flow,\n * but won\u2019t be included in the returned access token.\n */\n extraScopesToConsent?: string[]\n /**\n * User Interface configuration that MSAL uses when getting a token interactively or\n * authorizing an end user.\n */\n webviewParameters?: MSALWebviewParams\n}\n\n/**\n * OIDC prompt parameter that specifies whether the Authorization Server prompts the\n * End-User for reauthentication and consent.\n */\nexport enum MSALPromptType {\n /**\n * If no user is specified the authentication webview will present a list of users\n * currently signed in for the user to select among.\n */\n SELECT_ACCOUNT,\n /**\n * Require the user to authenticate in the webview.\n */\n LOGIN,\n /**\n * Require the user to consent to the current set of scopes for the request.\n */\n CONSENT,\n /**\n * The SSO experience will be determined by the presence of cookies in the webview and\n * account type. User won\u2019t be prompted unless necessary. If multiple users are signed in,\n * select account experience will be presented.\n */\n WHEN_REQUIRED,\n /**\n * Default is MSALPromptType.WHEN_REQUIRED.\n */\n DEFAULT = WHEN_REQUIRED,\n}\n\nexport interface MSALSilentParams {\n /**\n * Permissions you want included in the access token received in the result.\n * Not all scopes are guaranteed to be included in the access token returned.\n */\n scopes: string[]\n /**\n * An account object for which tokens should be returned.\n */\n account: MSALAccount\n /**\n * The authority that MSAL will use to obtain tokens. If not included, authority from\n * MSALConfiguration will be used.\n */\n authority?: string\n /**\n * Ignore any existing access token in the cache and force MSAL to get a new access token\n * from the service.\n */\n forceRefresh?: boolean\n}\n\nexport interface MSALSignoutParams {\n /**\n * The account object for which to sign out of.\n */\n account: MSALAccount\n /**\n * Specifies whether signout should also open the browser and send a network request to the end_session_endpoint.\n * false by default.\n */\n signoutFromBrowser?: boolean\n /**\n * User Interface configuration that MSAL uses when getting a token interactively or\n * authorizing an end user.\n */\n webviewParameters?: MSALWebviewParams\n}\n\nexport interface MSALResult {\n /**\n * The Access Token requested, or empty string if no access token is returned in response\n */\n accessToken: string\n /**\n * The account object that holds account information.\n */\n account: MSALAccount\n /**\n * The time that the access token returned in the accessToken property ceases to be valid.\n * This value is calculated based on current UTC time measured locally and the value expiresIn returned from the service\n */\n expiresOn: number\n /**\n * The raw id token if it\u2019s returned by the service or undefined if no id token is returned.\n */\n idToken?: string\n /**\n * The scope values returned from the service.\n */\n scopes: string[]\n /**\n * Identifier for the directory where account is locally represented\n */\n tenantId?: string\n}\n\nexport interface MSALAccount {\n /**\n * Unique identifier for the account.\n */\n identifier: string\n /**\n * Host part of the authority string used for authentication based on the issuer identifier.\n */\n environment?: string\n /**\n * An identifier for the AAD tenant that the account was acquired from.\n */\n tenantId: string\n /**\n * Shorthand name by which the End-User wishes to be referred to at the RP, such as janedoe or j.doe.\n */\n username: string\n /**\n * ID token claims for the account. Can be used to read additional information about the account, e.g. name.\n */\n claims?: object\n}\n\n/**\n * Mostly, if not all, iOS webview parameters\n * See https://azuread.github.io/microsoft-authentication-library-for-objc/Classes/MSALWebviewParameters.html\n */\nexport interface MSALWebviewParams {\n /**\n * A Boolean value that indicates whether the ASWebAuthenticationSession should ask the\n * browser for a private authentication session.\n * For more info see here: https://developer.apple.com/documentation/authenticationservices/aswebauthenticationsession/3237231-prefersephemeralwebbrowsersessio?language=objc\n * @platform iOS 13+\n */\n ios_prefersEphemeralWebBrowserSession?: boolean\n /**\n * MSAL requires a web browser for interactive authentication.\n * There are multiple web browsers available to complete authentication.\n * MSAL will default to the web browser that provides best security and user experience for a given platform.\n * Ios_MSALWebviewType allows changing the experience by customizing the configuration to other options for\n * displaying web content\n * @platform iOS\n */\n ios_webviewType?: Ios_MSALWebviewType\n /**\n * Note: Has no effect when ios_webviewType === `Ios_MSALWebviewType.DEFAULT` or\n * ios_webviewType === `Ios_MSALWebviewType.AUTHENTICATION_SESSION`\n * @platform iOS\n */\n ios_presentationStyle?: Ios_ModalPresentationStyle\n}\n\n/**\n * See https://developer.apple.com/documentation/uikit/uimodalpresentationstyle\n */\nexport enum Ios_ModalPresentationStyle {\n fullScreen = 0,\n pageSheet,\n formSheet,\n currentContext,\n custom,\n overFullScreen,\n overCurrentContext,\n popover,\n blurOverFullScreen,\n none = -1,\n automatic = -2,\n}\n\n/**\n * See https://azuread.github.io/microsoft-authentication-library-for-objc/Enums/MSALWebviewType.html\n */\nexport enum Ios_MSALWebviewType {\n DEFAULT = 0,\n AUTHENTICATION_SESSION,\n SAFARI_VIEW_CONTROLLER,\n WK_WEB_VIEW,\n}\n", "import { PublicClientApplication } from './src/publicClientApplication'\nexport default PublicClientApplication\nexport * from './src/types'\n"],
5
- "mappings": ";AAAA,SAAS,gBAAgB;AAazB,SAAS,qBAAqB;AAc9B,IAAM,SAA6B,cAAc;AAI1C,IAAM,0BAAN,MAAkE;AAAA,EAGvE,YAA6B,QAA2B;AAA3B;AAAA,EAA4B;AAAA,EAFjD,gBAAyB;AAAA,EAIjC,MAAa,OAAO;AAClB,QAAI,CAAC,KAAK,eAAe;AACvB,YAAM,OAAO,8BAA8B,KAAK,MAAM;AACtD,WAAK,gBAAgB;AAAA,IACvB;AACA,WAAO;AAAA,EACT;AAAA,EAEA,MAAa,aAAa,QAA+B;AACvD,SAAK,sBAAsB;AAC3B,WAAO,MAAM,OAAO,aAAa,MAAM;AAAA,EACzC;AAAA,EAEA,MAAa,mBAAmB,QAA0B;AACxD,SAAK,sBAAsB;AAC3B,WAAO,MAAM,OAAO,mBAAmB,MAAM;AAAA,EAC/C;AAAA,EAEA,MAAa,cAAc;AACzB,SAAK,sBAAsB;AAC3B,WAAO,MAAM,OAAO,YAAY;AAAA,EAClC;AAAA,EAEA,MAAa,WAAW,mBAA2B;AACjD,SAAK,sBAAsB;AAC3B,WAAO,MAAM,OAAO,WAAW,iBAAiB;AAAA,EAClD;AAAA,EAEA,MAAa,cAAc,SAAsB;AAC/C,SAAK,sBAAsB;AAC3B,WAAO,MAAM,OAAO,cAAc,OAAO;AAAA,EAC3C;AAAA,EAEA,MAAa,QAAQ,QAA2B;AAC9C,SAAK,sBAAsB;AAC3B,WAAO,MAAM,SAAS,OAAO;AAAA,MAC3B,KAAK,YAAY,MAAM,OAAO,QAAQ,MAAM;AAAA,MAC5C,SAAS,YAAY,MAAM,OAAO,cAAc,OAAO,OAAO;AAAA,IAChE,CAAC,EAAE;AAAA,EACL;AAAA,EAEA,MAAa,qBAAqB;AAChC,SAAK,sBAAsB;AAC3B,WAAO,MAAM,SAAS,OAAO;AAAA,MAC3B,SAAS,YAAY,MAAM,OAAO,mBAAmB;AAAA,MACrD,SAAS,YAAY;AAAA,IACvB,CAAC,EAAE;AAAA,EACL;AAAA,EAEA,MAAM,4BAA4B;AAChC,SAAK,sBAAsB;AAC3B,WAAO,MAAM,SAAS,OAAO;AAAA,MAC3B,SAAS,YAAY,CAAC,MAAM,OAAO,0BAA0B,CAAC;AAAA,MAC9D,SAAS,YAAY,CAAC;AAAA,IACxB,CAAC,EAAE;AAAA,EACL;AAAA,EAEQ,wBAAwB;AAC9B,QAAI,CAAC,KAAK,eAAe;AACvB,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;;;ACmEO,IAAK,iBAAL,kBAAKA,oBAAL;AAKL,EAAAA,gCAAA;AAIA,EAAAA,gCAAA;AAIA,EAAAA,gCAAA;AAMA,EAAAA,gCAAA;AAIA,EAAAA,gCAAA,aAAU,yBAAV;AAvBU,SAAAA;AAAA,GAAA;AAoJL,IAAK,6BAAL,kBAAKC,gCAAL;AACL,EAAAA,wDAAA,gBAAa,KAAb;AACA,EAAAA,wDAAA;AACA,EAAAA,wDAAA;AACA,EAAAA,wDAAA;AACA,EAAAA,wDAAA;AACA,EAAAA,wDAAA;AACA,EAAAA,wDAAA;AACA,EAAAA,wDAAA;AACA,EAAAA,wDAAA;AACA,EAAAA,wDAAA,UAAO,MAAP;AACA,EAAAA,wDAAA,eAAY,MAAZ;AAXU,SAAAA;AAAA,GAAA;AAiBL,IAAK,sBAAL,kBAAKC,yBAAL;AACL,EAAAA,0CAAA,aAAU,KAAV;AACA,EAAAA,0CAAA;AACA,EAAAA,0CAAA;AACA,EAAAA,0CAAA;AAJU,SAAAA;AAAA,GAAA;;;AC3UZ,IAAO,6BAAQ;",
4
+ "sourcesContent": ["import { Platform } from 'react-native'\n\nimport type {\n MSALConfiguration,\n MSALInteractiveParams,\n MSALSilentParams,\n MSALAccount,\n MSALSignoutParams,\n IPublicClientApplication,\n MSALResult,\n MSALAndroidPreferredBrowser,\n} from './types'\n\nimport { NativeModules } from 'react-native'\n\ntype RNMSALNativeModule = {\n createPublicClientApplication(config: MSALConfiguration): Promise<void>\n acquireToken(params: MSALInteractiveParams): Promise<MSALResult | undefined>\n acquireTokenSilent(params: MSALSilentParams): Promise<MSALResult | undefined>\n getAccounts(): Promise<MSALAccount[]>\n getAccount(accountIdentifier: string): Promise<MSALAccount | undefined>\n removeAccount(account: MSALAccount): Promise<boolean>\n signout(params: MSALSignoutParams): Promise<boolean>\n getSelectedBrowser(): Promise<string>\n getSafeCustomTabsBrowsers(): Promise<MSALAndroidPreferredBrowser[]>\n}\n\nconst RNMSAL: RNMSALNativeModule = NativeModules.RNMSAL\n\n// export default RNMSAL\n\nexport class PublicClientApplication implements IPublicClientApplication {\n private isInitialized: boolean = false\n\n constructor(private readonly config: MSALConfiguration) {}\n\n public async init() {\n if (!this.isInitialized) {\n await RNMSAL.createPublicClientApplication(this.config)\n this.isInitialized = true\n }\n return this\n }\n\n public async acquireToken(params: MSALInteractiveParams) {\n this.validateIsInitialized()\n return await RNMSAL.acquireToken(params)\n }\n\n public async acquireTokenSilent(params: MSALSilentParams) {\n this.validateIsInitialized()\n return await RNMSAL.acquireTokenSilent(params)\n }\n\n public async getAccounts() {\n this.validateIsInitialized()\n return await RNMSAL.getAccounts()\n }\n\n public async getAccount(accountIdentifier: string) {\n this.validateIsInitialized()\n return await RNMSAL.getAccount(accountIdentifier)\n }\n\n public async removeAccount(account: MSALAccount) {\n this.validateIsInitialized()\n return await RNMSAL.removeAccount(account)\n }\n\n public async signOut(params: MSALSignoutParams) {\n this.validateIsInitialized()\n return await Platform.select({\n ios: async () => await RNMSAL.signout(params),\n default: async () => await RNMSAL.removeAccount(params.account),\n })()\n }\n\n public async getSelectedBrowser() {\n this.validateIsInitialized()\n return await Platform.select({\n android: async () => await RNMSAL.getSelectedBrowser(),\n default: async () => 'N/A',\n })()\n }\n\n async getSafeCustomTabsBrowsers() {\n this.validateIsInitialized()\n return await Platform.select({\n android: async () => await RNMSAL.getSafeCustomTabsBrowsers(),\n default: async () => [],\n })()\n }\n\n private validateIsInitialized() {\n if (!this.isInitialized) {\n throw new Error(\n 'PublicClientApplication is not initialized. You must call the `init` method before any other method.',\n )\n }\n }\n}\n", "export interface IPublicClientApplication {\n /**\n * Acquire a token interactively\n * @param {MSALInteractiveParams} params\n * @return Result containing an access token and account identifier\n * used for acquiring subsequent tokens silently\n */\n acquireToken(params: MSALInteractiveParams): Promise<MSALResult | undefined>\n\n /**\n * Acquire a token silently\n * @param {MSALSilentParams} params - Includes the account identifer retrieved from a\n * previous interactive login\n * @return Result containing an access token and account identifier\n * used for acquiring subsequent tokens silently\n */\n acquireTokenSilent(params: MSALSilentParams): Promise<MSALResult | undefined>\n\n /**\n * Get all accounts for which this application has refresh tokens\n * @return Promise containing array of MSALAccount objects for which this application\n * has refresh tokens.\n */\n getAccounts(): Promise<MSALAccount[]>\n\n /**\n * Retrieve the account matching the identifier\n * @return Promise containing MSALAccount object\n */\n getAccount(accountIdentifier: string): Promise<MSALAccount | undefined>\n\n /**\n * Removes all tokens from the cache for this application for the provided\n * account.\n * @param {MSALAccount} account\n * @return A promise containing a boolean = true if account removal was successful\n * otherwise rejects\n */\n removeAccount(account: MSALAccount): Promise<boolean>\n\n /**\n * Removes all tokens from the cache for this application for the provided\n * account. Additionally, this will remove the account from the system browser.\n * NOTE: iOS only. On Android and web this is the same as `removeAccount`.\n * @param {MSALSignoutParams} params\n * @return A promise which resolves if sign out is successful,\n * otherwise rejects\n * @platform ios\n */\n signOut(params: MSALSignoutParams): Promise<boolean>\n\n /**\n * Returns the browser that will be used for interactive authentication.\n * NOTE: Android only. On iOS this will always return 'N/A'.\n * @return Promise resolving to the package name and version of the browser that will be used\n * for interactive authentication.\n * @platform android\n */\n getSelectedBrowser(): Promise<string>\n\n /**\n * Returns a array of installed browsers found in the configured safe list that support customTab.\n * NOTE: Android only. On iOS this will always return N/A.\n * @return Promise resolving to an array of installed browsers that support customTab\n * @platform android\n */\n getSafeCustomTabsBrowsers(): Promise<MSALAndroidPreferredBrowser[]>\n}\n\nexport interface MSALConfiguration {\n auth: {\n /**\n * The client ID of the application, this should come from the app developer portal.\n */\n clientId: string\n /**\n * The authority the application will use to obtain tokens.\n */\n authority?: string\n /**\n * List of known authorities that the application should trust.\n */\n knownAuthorities?: string[]\n /**\n * The redirect URI of the application.\n *\n * If you are providing this property, you should probably use `Platform.select`,\n * because the redirect uris will be different for each platform.\n */\n redirectUri?: string\n }\n /**\n * Options as described here: {@link https://docs.microsoft.com/en-us/azure/active-directory/develop/msal-configuration}\n * @platform android\n */\n androidConfigOptions?: MSALAndroidConfigOptions\n}\n\nexport interface MSALAndroidPreferredBrowser {\n browser_package_name: string\n browser_signature_hashes: string[]\n browser_version_lower_bound?: string\n browser_version_upper_bound?: string\n}\n\nexport interface MSALAndroidConfigOptions {\n authorization_user_agent?: 'DEFAULT' | 'BROWSER' | 'WEBVIEW'\n broker_redirect_uri_registered?: boolean\n preferred_browser?: MSALAndroidPreferredBrowser\n browser_safelist?: {\n browser_package_name: string\n browser_signature_hashes: string[]\n browser_use_customTab: boolean\n }[]\n http?: {\n connect_timeout?: number\n read_timeout?: number\n }\n logging?: {\n pii_enabled?: boolean\n log_level?: 'ERROR' | 'WARNING' | 'INFO' | 'VERBOSE'\n logcat_enabled?: boolean\n }\n multiple_clouds_supported?: boolean\n}\n\nexport interface MSALInteractiveParams {\n /**\n * Permissions you want included in the access token received in the result.\n * Not all scopes are guaranteed to be included in the access token returned.\n */\n scopes: string[]\n /**\n * The authority that MSAL will use to obtain tokens. If not included, authority from\n * MSALConfiguration will be used.\n */\n authority?: string\n /**\n * A specific prompt type for the interactive authentication flow.\n */\n promptType?: MSALPromptType\n /**\n * A loginHint (usually an email) to pass to the service at the beginning of the\n * interactive authentication flow. The account returned is not guaranteed to match\n * the loginHint.\n */\n loginHint?: string\n /**\n * Key-value pairs to pass to the /authorize and /token endpoints.\n */\n extraQueryParameters?: Record<string, string>\n /**\n * Permissions you want the account to consent to in the same authentication flow,\n * but won\u2019t be included in the returned access token.\n */\n extraScopesToConsent?: string[]\n /**\n * User Interface configuration that MSAL uses when getting a token interactively or\n * authorizing an end user.\n */\n webviewParameters?: MSALWebviewParams\n}\n\n/**\n * OIDC prompt parameter that specifies whether the Authorization Server prompts the\n * End-User for reauthentication and consent.\n */\nexport enum MSALPromptType {\n /**\n * If no user is specified the authentication webview will present a list of users\n * currently signed in for the user to select among.\n */\n SELECT_ACCOUNT,\n /**\n * Require the user to authenticate in the webview.\n */\n LOGIN,\n /**\n * Require the user to consent to the current set of scopes for the request.\n */\n CONSENT,\n /**\n * The SSO experience will be determined by the presence of cookies in the webview and\n * account type. User won\u2019t be prompted unless necessary. If multiple users are signed in,\n * select account experience will be presented.\n */\n WHEN_REQUIRED,\n /**\n * Default is MSALPromptType.WHEN_REQUIRED.\n */\n DEFAULT = WHEN_REQUIRED,\n}\n\nexport interface MSALSilentParams {\n /**\n * Permissions you want included in the access token received in the result.\n * Not all scopes are guaranteed to be included in the access token returned.\n */\n scopes: string[]\n /**\n * An account object for which tokens should be returned.\n */\n account: MSALAccount\n /**\n * The authority that MSAL will use to obtain tokens. If not included, authority from\n * MSALConfiguration will be used.\n */\n authority?: string\n /**\n * Ignore any existing access token in the cache and force MSAL to get a new access token\n * from the service.\n */\n forceRefresh?: boolean\n}\n\nexport interface MSALSignoutParams {\n /**\n * The account object for which to sign out of.\n */\n account: MSALAccount\n /**\n * Specifies whether signout should also open the browser and send a network request to the end_session_endpoint.\n * false by default.\n */\n signoutFromBrowser?: boolean\n /**\n * User Interface configuration that MSAL uses when getting a token interactively or\n * authorizing an end user.\n */\n webviewParameters?: MSALWebviewParams\n}\n\nexport interface MSALResult {\n /**\n * The Access Token requested, or empty string if no access token is returned in response\n */\n accessToken: string\n /**\n * The account object that holds account information.\n */\n account: MSALAccount\n /**\n * The time that the access token returned in the accessToken property ceases to be valid.\n * This value is calculated based on current UTC time measured locally and the value expiresIn returned from the service\n */\n expiresOn: number\n /**\n * The raw id token if it\u2019s returned by the service or undefined if no id token is returned.\n */\n idToken?: string\n /**\n * The scope values returned from the service.\n */\n scopes: string[]\n /**\n * Identifier for the directory where account is locally represented\n */\n tenantId?: string\n}\n\nexport interface MSALAccount {\n /**\n * Unique identifier for the account.\n */\n identifier: string\n /**\n * Host part of the authority string used for authentication based on the issuer identifier.\n */\n environment?: string\n /**\n * An identifier for the AAD tenant that the account was acquired from.\n */\n tenantId: string\n /**\n * Shorthand name by which the End-User wishes to be referred to at the RP, such as janedoe or j.doe.\n */\n username: string\n /**\n * ID token claims for the account. Can be used to read additional information about the account, e.g. name.\n */\n claims?: object\n}\n\n/**\n * Mostly, if not all, iOS webview parameters\n * See https://azuread.github.io/microsoft-authentication-library-for-objc/Classes/MSALWebviewParameters.html\n */\nexport interface MSALWebviewParams {\n /**\n * A Boolean value that indicates whether the ASWebAuthenticationSession should ask the\n * browser for a private authentication session.\n * For more info see here: https://developer.apple.com/documentation/authenticationservices/aswebauthenticationsession/3237231-prefersephemeralwebbrowsersessio?language=objc\n * @platform iOS 13+\n */\n ios_prefersEphemeralWebBrowserSession?: boolean\n /**\n * MSAL requires a web browser for interactive authentication.\n * There are multiple web browsers available to complete authentication.\n * MSAL will default to the web browser that provides best security and user experience for a given platform.\n * Ios_MSALWebviewType allows changing the experience by customizing the configuration to other options for\n * displaying web content\n * @platform iOS\n */\n ios_webviewType?: Ios_MSALWebviewType\n /**\n * Note: Has no effect when ios_webviewType === `Ios_MSALWebviewType.DEFAULT` or\n * ios_webviewType === `Ios_MSALWebviewType.AUTHENTICATION_SESSION`\n * @platform iOS\n */\n ios_presentationStyle?: Ios_ModalPresentationStyle\n}\n\n/**\n * See https://developer.apple.com/documentation/uikit/uimodalpresentationstyle\n */\nexport enum Ios_ModalPresentationStyle {\n fullScreen = 0,\n pageSheet,\n formSheet,\n currentContext,\n custom,\n overFullScreen,\n overCurrentContext,\n popover,\n blurOverFullScreen,\n none = -1,\n automatic = -2,\n}\n\n/**\n * See https://azuread.github.io/microsoft-authentication-library-for-objc/Enums/MSALWebviewType.html\n */\nexport enum Ios_MSALWebviewType {\n DEFAULT = 0,\n AUTHENTICATION_SESSION,\n SAFARI_VIEW_CONTROLLER,\n WK_WEB_VIEW,\n}\n", "import { PublicClientApplication } from './src/publicClientApplication'\nexport default PublicClientApplication\nexport * from './src/types'\n"],
5
+ "mappings": ";AAAA,SAAS,gBAAgB;AAazB,SAAS,qBAAqB;AAc9B,IAAM,SAA6B,cAAc;AAI1C,IAAM,0BAAN,MAAkE;AAAA,EAGvE,YAA6B,QAA2B;AAA3B;AAAA,EAA4B;AAAA,EAFjD,gBAAyB;AAAA,EAIjC,MAAa,OAAO;AAClB,QAAI,CAAC,KAAK,eAAe;AACvB,YAAM,OAAO,8BAA8B,KAAK,MAAM;AACtD,WAAK,gBAAgB;AAAA,IACvB;AACA,WAAO;AAAA,EACT;AAAA,EAEA,MAAa,aAAa,QAA+B;AACvD,SAAK,sBAAsB;AAC3B,WAAO,MAAM,OAAO,aAAa,MAAM;AAAA,EACzC;AAAA,EAEA,MAAa,mBAAmB,QAA0B;AACxD,SAAK,sBAAsB;AAC3B,WAAO,MAAM,OAAO,mBAAmB,MAAM;AAAA,EAC/C;AAAA,EAEA,MAAa,cAAc;AACzB,SAAK,sBAAsB;AAC3B,WAAO,MAAM,OAAO,YAAY;AAAA,EAClC;AAAA,EAEA,MAAa,WAAW,mBAA2B;AACjD,SAAK,sBAAsB;AAC3B,WAAO,MAAM,OAAO,WAAW,iBAAiB;AAAA,EAClD;AAAA,EAEA,MAAa,cAAc,SAAsB;AAC/C,SAAK,sBAAsB;AAC3B,WAAO,MAAM,OAAO,cAAc,OAAO;AAAA,EAC3C;AAAA,EAEA,MAAa,QAAQ,QAA2B;AAC9C,SAAK,sBAAsB;AAC3B,WAAO,MAAM,SAAS,OAAO;AAAA,MAC3B,KAAK,YAAY,MAAM,OAAO,QAAQ,MAAM;AAAA,MAC5C,SAAS,YAAY,MAAM,OAAO,cAAc,OAAO,OAAO;AAAA,IAChE,CAAC,EAAE;AAAA,EACL;AAAA,EAEA,MAAa,qBAAqB;AAChC,SAAK,sBAAsB;AAC3B,WAAO,MAAM,SAAS,OAAO;AAAA,MAC3B,SAAS,YAAY,MAAM,OAAO,mBAAmB;AAAA,MACrD,SAAS,YAAY;AAAA,IACvB,CAAC,EAAE;AAAA,EACL;AAAA,EAEA,MAAM,4BAA4B;AAChC,SAAK,sBAAsB;AAC3B,WAAO,MAAM,SAAS,OAAO;AAAA,MAC3B,SAAS,YAAY,MAAM,OAAO,0BAA0B;AAAA,MAC5D,SAAS,YAAY,CAAC;AAAA,IACxB,CAAC,EAAE;AAAA,EACL;AAAA,EAEQ,wBAAwB;AAC9B,QAAI,CAAC,KAAK,eAAe;AACvB,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;;;ACmEO,IAAK,iBAAL,kBAAKA,oBAAL;AAKL,EAAAA,gCAAA;AAIA,EAAAA,gCAAA;AAIA,EAAAA,gCAAA;AAMA,EAAAA,gCAAA;AAIA,EAAAA,gCAAA,aAAU,yBAAV;AAvBU,SAAAA;AAAA,GAAA;AAoJL,IAAK,6BAAL,kBAAKC,gCAAL;AACL,EAAAA,wDAAA,gBAAa,KAAb;AACA,EAAAA,wDAAA;AACA,EAAAA,wDAAA;AACA,EAAAA,wDAAA;AACA,EAAAA,wDAAA;AACA,EAAAA,wDAAA;AACA,EAAAA,wDAAA;AACA,EAAAA,wDAAA;AACA,EAAAA,wDAAA;AACA,EAAAA,wDAAA,UAAO,MAAP;AACA,EAAAA,wDAAA,eAAY,MAAZ;AAXU,SAAAA;AAAA,GAAA;AAiBL,IAAK,sBAAL,kBAAKC,yBAAL;AACL,EAAAA,0CAAA,aAAU,KAAV;AACA,EAAAA,0CAAA;AACA,EAAAA,0CAAA;AACA,EAAAA,0CAAA;AAJU,SAAAA;AAAA,GAAA;;;AC3UZ,IAAO,6BAAQ;",
6
6
  "names": ["MSALPromptType", "Ios_ModalPresentationStyle", "Ios_MSALWebviewType"]
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-msal2",
3
- "version": "1.0.16",
3
+ "version": "1.0.18",
4
4
  "license": "MIT",
5
5
  "description": "MSAL React Native wrapper for iOS and Android",
6
6
  "homepage": "https://github.com/bittu/react-native-msal2#readme",
@@ -22,7 +22,7 @@ type RNMSALNativeModule = {
22
22
  removeAccount(account: MSALAccount): Promise<boolean>
23
23
  signout(params: MSALSignoutParams): Promise<boolean>
24
24
  getSelectedBrowser(): Promise<string>
25
- getSafeCustomTabsBrowsers(): Promise<MSALAndroidPreferredBrowser>
25
+ getSafeCustomTabsBrowsers(): Promise<MSALAndroidPreferredBrowser[]>
26
26
  }
27
27
 
28
28
  const RNMSAL: RNMSALNativeModule = NativeModules.RNMSAL
@@ -86,7 +86,7 @@ export class PublicClientApplication implements IPublicClientApplication {
86
86
  async getSafeCustomTabsBrowsers() {
87
87
  this.validateIsInitialized()
88
88
  return await Platform.select({
89
- android: async () => [await RNMSAL.getSafeCustomTabsBrowsers()],
89
+ android: async () => await RNMSAL.getSafeCustomTabsBrowsers(),
90
90
  default: async () => [],
91
91
  })()
92
92
  }
package/src/types.ts CHANGED
@@ -97,16 +97,16 @@ export interface MSALConfiguration {
97
97
  }
98
98
 
99
99
  export interface MSALAndroidPreferredBrowser {
100
- browser_package_name: string;
101
- browser_signature_hashes: string[];
102
- browser_version_lower_bound?: string;
103
- browser_version_upper_bound?: string;
100
+ browser_package_name: string
101
+ browser_signature_hashes: string[]
102
+ browser_version_lower_bound?: string
103
+ browser_version_upper_bound?: string
104
104
  }
105
105
 
106
106
  export interface MSALAndroidConfigOptions {
107
107
  authorization_user_agent?: 'DEFAULT' | 'BROWSER' | 'WEBVIEW'
108
108
  broker_redirect_uri_registered?: boolean
109
- preferred_browser?: MSALAndroidPreferredBrowser;
109
+ preferred_browser?: MSALAndroidPreferredBrowser
110
110
  browser_safelist?: {
111
111
  browser_package_name: string
112
112
  browser_signature_hashes: string[]