Skip to content
This repository was archived by the owner on Jun 10, 2025. It is now read-only.

Commit 660e0e8

Browse files
authored
Merge pull request #16 from Azure-Samples/jason/updateMSAL0.4.0
Update sample to MSAL 0.4.0
2 parents 70a95c9 + 448bd7a commit 660e0e8

File tree

7 files changed

+218
-233
lines changed

7 files changed

+218
-233
lines changed

Cartfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
github "AzureAD/microsoft-authentication-library-for-objc" "dev"
1+
github "AzureAD/microsoft-authentication-library-for-objc" "0.4.2"

Cartfile.resolved

Lines changed: 0 additions & 1 deletion
This file was deleted.

MSALiOSB2C/AppDelegate.swift

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,13 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
3636

3737
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
3838

39-
let logger = MSALLogger.init()
40-
41-
4239
/** When capturing log messages from MSAL you only need to capture either messages where
4340
containsPII == YES or containsPII == NO, as log messages are duplicated between the
4441
two, however the containsPII version might contain Personally Identifiable Information (PII)
4542
about the user being logged in.
4643
*/
4744

48-
logger.setCallback { (logLevel, message, containsPII) in
45+
MSALGlobalConfig.loggerConfig.setLogCallback { (logLevel, message, containsPII) in
4946

5047
if (!containsPII) {
5148

@@ -83,8 +80,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
8380

8481
print("Received callback!")
8582

86-
MSALPublicClientApplication.handleMSALResponse(url)
83+
guard let sourceApp = sourceApplication else { return false }
8784

85+
MSALPublicClientApplication.handleMSALResponse(url, sourceApplication: sourceApp)
8886

8987
return true
9088
}

MSALiOSB2C/Info.plist

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
<key>CFBundleURLSchemes</key>
2929
<array>
3030
<string>msal90c0fe63-bcf2-44d5-8fb7-b8bbc0b29dc6</string>
31-
<string>auth</string>
3231
</array>
3332
</dict>
3433
</array>

MSALiOSB2C/MSALiOSB2C.entitlements

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
<dict>
55
<key>keychain-access-groups</key>
66
<array>
7-
<string>$(AppIdentifierPrefix)com.microsoft.identity.client.sample.MSALiOSB2C</string>
8-
<string>$(AppIdentifierPrefix)com.microsoft.msalcache</string>
7+
<string>$(AppIdentifierPrefix)com.microsoft.adalcache</string>
98
</array>
109
</dict>
1110
</plist>

MSALiOSB2C/ViewController.swift

Lines changed: 208 additions & 222 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@ The MSAL preview library for iOS and macOS gives your app the ability to begin u
2525

2626
```swift
2727
do {
28-
let application = try MSALPublicClientApplication.init(clientId: <your-client-id-here> authority: kAuthority)
28+
// Create an instance of MSALPublicClientApplication with proper config
29+
let authority = try MSALB2CAuthority(url: URL(string:kAuthority)!)
30+
let pcaConfig = MSALPublicClientApplicationConfig(clientId: <your-client-id-here>, redirectUri: nil, authority: authority)
31+
let application = try MSALPublicClientApplication(configuration: pcaConfig)
32+
2933
application.acquireToken(forScopes: kScopes) { (result, error) in
3034
DispatchQueue.main.async {
3135
if result != nil {

0 commit comments

Comments
 (0)