Hello i’m trying to implement self-register on iOS and tried to follow the sample in okta-idx-swift , but after proceeding, it just loops me back at select-enroll-profile. thank you!
sample code
Task{
do{
if #available(iOS 15.0, *) {
var response = try await idxFlow.start()
guard let remediation = response.remediations[.identify],
let usernameField = remediation["identifier"],
let passwordField = remediation["credentials.passcode"]
else{
return completion(.failure(HssOktaError.generalError("Failed indentifying remidiation, check available remidiation fields")))
}
usernameField.value = email
passwordField.value = password
response = try await remediation.proceed()
guard response.isLoginSuccessful
else{
completion(.success(self.mapResponeToIdxResponse(response: response, token: nil)))
return
}
let token = try await response.exchangeCode()
completion(.success(self.mapResponeToIdxResponse(response: response,token: OktaToken(
id: token.id,
token: token.idToken?.rawValue ?? "",
issuedAt: Int64(((token.issuedAt?.timeIntervalSince1970 ?? 0) * 1000.0).rounded()),
tokenType: token.tokenType,
accessToken: token.accessToken,
scope: token.scope ?? "",
refreshToken: token.refreshToken ?? ""
))))
} else {
completion(.failure(HssOktaError.generalError("This method is Only Avaialable to iOS 15.0 or newer")))
}
}catch let error{
completion(.failure(HssOktaError.generalError(error.localizedDescription.debugDescription)))
}