Freedom ID SDK iOS
import FreedomID
let freedomID = FreedomID.create(apiKey: "your_api_key")
let grants = [DataGrants.readFirstname, DataGrants.readLastname]
freedomID.authorize(viewController: self, dataGrants: grants) { (result: Result<GrantedProfile, AuthError>) in
switch result {
case .success(let grantedProfile):
// Authorization successful 🚀
let fullname = grantedProfile.firstname + " " + grantedProfile.lastname
// Do something with the grantedProfile
case .failure(let error):
// Authorization failed ⛔
// Handle the error accordingly
break;
}
}
FreedomID.clear()
public struct GrantedProfile: Codable {
public var id: String = ""
public var email: String = ""
public var emails: [String] = [ ]
public var nationality: String = ""
public var phone: String = ""
public var phones: [String] = [ ]
public var dateOfBirth: String = ""
public var firstname: String = ""
public var lastname: String = ""
public var patronymic: String? = ""
public var gender: String = ""
public var country: String = ""
}