I tried the Example code and set different preferredAuthMethods .ciam and .keycloak in the following method:
let config = MBMobileSDKConfiguration(applicationIdentifier: "example",
authenticationConfigs: [
ROPCAuthenticationConfig(clientId: clientId, type: .keycloak),
ROPCAuthenticationConfig(clientId: clientId, type: .ciam)
],
endpoint: MBMobileSDKEndpoint(region: .ece,
stage: .mock),
preferredAuthMethod: .ciam) <---- set either .ciam or .keycloak
Here is the result value from the following call:
loginProvider.login(username: username, credential: self.credential(for: loginProvider.type, pin: pin, nonce: nonce)) { [weak self] result in
switch result {
case .success:
LOG.V("Succcessfully logged in user; Fetching user data...")
self?.fetchUser(completion: completion)
case .failure(let error):
LOG.E("Login request did fail with error: \(error)")
completion(.failure(error))
}
}
case 1: when loginProvider.type = .keycloak the result is:
(lldb) p result
(Result<Void, MBMobileSDK.LoginServiceError>) $R7 = failure {
failure = loginDidFail {
loginDidFail = some {
type = unknown
description = nil
}
}
}
case 2: When the loginProvider.type = .ciam the result is:
(lldb) p result
(Result<Void, MBMobileSDK.LoginServiceError>) $R0 = failure {
failure = loginDidFail {
loginDidFail = some {
type = http {
http = unauthorized {
unauthorized = {
data = 86 bytes
}
}
}
description = "invalid_client -> Invalid client or client credentials."
}
}
}
(lldb)
In case 2 I tried to use the valid client Id allocated to me in my developer account console but still got the same error.
regression - Whether I set the sdk endpoint as the following resulted the same error:
MBMobileSDKEndpoint(region: .ece, stage: .mock)
or
MBMobileSDKEndpoint(region: .ece, stage: .prod)
It looks like the authentication server has bug which simply prevent the authentication from MobileSDK. The same authentication mechanism used in log into developer account works fine.
I tried the Example code and set different preferredAuthMethods .ciam and .keycloak in the following method:
Here is the result value from the following call:
case 1: when loginProvider.type = .keycloak the result is:
(lldb) p result (Result<Void, MBMobileSDK.LoginServiceError>) $R7 = failure { failure = loginDidFail { loginDidFail = some { type = unknown description = nil } } }
case 2: When the loginProvider.type = .ciam the result is:
(lldb) p result (Result<Void, MBMobileSDK.LoginServiceError>) $R0 = failure { failure = loginDidFail { loginDidFail = some { type = http { http = unauthorized { unauthorized = { data = 86 bytes } } } description = "invalid_client -> Invalid client or client credentials." } } } (lldb)
In case 2 I tried to use the valid client Id allocated to me in my developer account console but still got the same error.
regression - Whether I set the sdk endpoint as the following resulted the same error:
MBMobileSDKEndpoint(region: .ece, stage: .mock) or MBMobileSDKEndpoint(region: .ece, stage: .prod)
It looks like the authentication server has bug which simply prevent the authentication from MobileSDK. The same authentication mechanism used in log into developer account works fine.