From d2fc507b77e74f01ffaaf38c5da226886ac8b509 Mon Sep 17 00:00:00 2001 From: Saeed Bashir Date: Mon, 25 Nov 2024 16:19:34 +0500 Subject: [PATCH] fix: fix microsoft login issue on iOS after config branch merges (#96) --- Core/Core/Configuration/Config/MicrosoftConfig.swift | 8 ++++---- .../Core/Providers/SocialAuth/MicrosoftAuthProvider.swift | 5 +++-- Core/CoreTests/Configuration/ConfigTests.swift | 4 ++-- Documentation/CONFIGURATION_MANAGEMENT.md | 2 +- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Core/Core/Configuration/Config/MicrosoftConfig.swift b/Core/Core/Configuration/Config/MicrosoftConfig.swift index 4175a53e2..30ca1df09 100644 --- a/Core/Core/Configuration/Config/MicrosoftConfig.swift +++ b/Core/Core/Configuration/Config/MicrosoftConfig.swift @@ -9,19 +9,19 @@ import Foundation private enum MicrosoftKeys: String { case enabled = "ENABLED" - case appID = "APP_ID" + case clientID = "CLIENT_ID" } public final class MicrosoftConfig: NSObject { public var enabled: Bool = false - private(set) var appID: String? + private(set) var clientID: String? private var requiredKeysAvailable: Bool { - return appID != nil + return clientID != nil } init(dictionary: [String: AnyObject]) { - appID = dictionary[MicrosoftKeys.appID.rawValue] as? String + clientID = dictionary[MicrosoftKeys.clientID.rawValue] as? String super.init() enabled = requiredKeysAvailable && dictionary[MicrosoftKeys.enabled.rawValue] as? Bool == true } diff --git a/Core/Core/Providers/SocialAuth/MicrosoftAuthProvider.swift b/Core/Core/Providers/SocialAuth/MicrosoftAuthProvider.swift index 2fd998579..878eb4273 100644 --- a/Core/Core/Providers/SocialAuth/MicrosoftAuthProvider.swift +++ b/Core/Core/Providers/SocialAuth/MicrosoftAuthProvider.swift @@ -76,10 +76,11 @@ public final class MicrosoftAuthProvider { } private func createClientApplication() throws -> MSALPublicClientApplication { - guard let config = Container.shared.resolve(ConfigProtocol.self), let appID = config.microsoft.appID else { + guard let config = Container.shared.resolve(ConfigProtocol.self), + let clientID = config.microsoft.clientID else { throw SocialAuthError.error(text: "Configuration error") } - let configuration = MSALPublicClientApplicationConfig(clientId: appID) + let configuration = MSALPublicClientApplicationConfig(clientId: clientID) do { return try MSALPublicClientApplication(configuration: configuration) diff --git a/Core/CoreTests/Configuration/ConfigTests.swift b/Core/CoreTests/Configuration/ConfigTests.swift index 35a90c2b7..6bb188dea 100644 --- a/Core/CoreTests/Configuration/ConfigTests.swift +++ b/Core/CoreTests/Configuration/ConfigTests.swift @@ -48,7 +48,7 @@ class ConfigTests: XCTestCase { ], "MICROSOFT": [ "ENABLED": true, - "APP_ID": "appId" + "CLIENT_ID": "cliendID" ], "APPLE_SIGNIN": [ "ENABLED": true @@ -119,7 +119,7 @@ class ConfigTests: XCTestCase { let config = Config(properties: properties) XCTAssertTrue(config.microsoft.enabled) - XCTAssertEqual(config.microsoft.appID, "appId") + XCTAssertEqual(config.microsoft.clientID, "cliendID") } func testAppleConfigInitialization() { diff --git a/Documentation/CONFIGURATION_MANAGEMENT.md b/Documentation/CONFIGURATION_MANAGEMENT.md index b7db2e6d9..b8695e546 100644 --- a/Documentation/CONFIGURATION_MANAGEMENT.md +++ b/Documentation/CONFIGURATION_MANAGEMENT.md @@ -87,7 +87,7 @@ FIREBASE: MICROSOFT: ENABLED: true - APP_ID: "microsoftAppID" + CLIENT_ID: "microsoftAppID" ``` `shared.yaml`: