Skip to content
This repository was archived by the owner on Feb 11, 2023. It is now read-only.

Commit 23918e0

Browse files
author
Chase Crawford
committed
Added bug fixes
1 parent d2d4939 commit 23918e0

File tree

5 files changed

+18
-11
lines changed

5 files changed

+18
-11
lines changed

src/msal-capacitor-plugin-demo/ios/App/Podfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def capacitor_pods
1010
# Automatic Capacitor Pod dependencies, do not delete
1111
pod 'Capacitor', :path => '../../node_modules/@capacitor/ios'
1212
pod 'CapacitorCordova', :path => '../../node_modules/@capacitor/ios'
13-
pod 'AssimalignMsalCapacitorPlugin', :path => '../../../msal-capacitor-plugin'
13+
pod 'AssimalignMsalCapacitorPlugin', :path => '..\..\..\msal-capacitor-plugin'
1414
# Do not delete
1515
end
1616

src/msal-capacitor-plugin-demo/src/context/auth/AuthContext.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,15 @@ export const useAuthentication = (): IAuthContext => {
3030
scopes: [
3131
'user.read'
3232
],
33+
webOptions: {
34+
cacheLocation: 'sessionStorage', // Can either be localStorage or sessionStorage or Web App. Default is sessionStorage
35+
storeAuthStateInCookie: true
36+
},
3337
iosOptions: {
34-
tokenCache: 'sessionStorage',
38+
keyShareLocation: 'com.company.cache', // This is the Keyshare location where credentials are stored for silent login
39+
enableBiometrics: true
40+
},
41+
androidOptions: {
3542
enableBiometrics: true
3643
}
3744
}))

src/msal-capacitor-plugin/ios/Plugin/Plugin.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,16 @@ public class MsalPlugin: CAPPlugin {
4949
var tokenCache = ""
5050

5151
#if os(iOS)
52-
if isoOptions["tokenCache"] == nil {
52+
if isoOptions["keyShareLocation"] == nil {
5353
tokenCache = "com.microsoft.adalcache"
5454
} else {
55-
tokenCache = isoOptions["tokenCache"] as! String
55+
tokenCache = isoOptions["keyShareLocation"] as! String
5656
}
5757
#else
58-
if isoOptions["tokenCache"] == nil {
58+
if isoOptions["keyShareLocation"] == nil {
5959
tokenCache = "com.microsoft.identity.universalstorage"
6060
} else {
61-
tokenCache = isoOptions["tokenCache"] as! String
61+
tokenCache = isoOptions["keyShareLocation"] as! String
6262
}
6363
#endif
6464
clientConfiguration.cacheConfig.keychainSharingGroup = tokenCache

src/msal-capacitor-plugin/src/definitions.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@ declare module '@capacitor/core' {
77
}
88

99
export interface IMsalAndroidPluginOptions {
10-
10+
enableBiometrics?: boolean;
1111
}
1212

1313
export interface IMsalWebPluginOptions {
14-
cacheLocation: 'sessionStorage' | 'localStorage';
15-
storeAuthStateInCookie: boolean;
14+
cacheLocation?: 'sessionStorage' | 'localStorage';
15+
storeAuthStateInCookie?: boolean;
1616
}
1717

1818
export interface IMsalIosPluginOptions {
19-
tokenCache?: string;
19+
keyShareLocation?: string;
2020
enableBiometrics?: boolean;
2121
}
2222

src/msal-capacitor-plugin/src/web.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export class MsalPluginWeb extends WebPlugin implements IMsalPlugin {
3232
authority: options.authority
3333
},
3434
cache: {
35-
cacheLocation: options?.webOptions?.cacheLocation ?? "localStorage",
35+
cacheLocation: options?.webOptions?.cacheLocation ?? "sessionStorage",
3636
storeAuthStateInCookie: options?.webOptions?.storeAuthStateInCookie ?? true
3737
}
3838
})

0 commit comments

Comments
 (0)