Freedom ID SDK Android
// build.gradle
dependencies {
implementation files('libs/freedom-id-sdk.aar')
}
//settings.gradle
repositories {
flatDir {
dirs("libs")
}
}
val apiKey = YOUR_API_KEY
val context = applicationContext
val freedomID = FreedomID.create(apiKey, context)
val fragmentManager = supportFragmentManager
val dataPermissions = arrayOf(DataGrants.READ_FIRSTNAME, DataPermissions.READ_LASTNAME)
freedomID.authorize(fragmentManager, dataPermissions) { authResult ->
when(authResult) {
is AuthResult.Success -> {
// Authorization successful 🚀
val profile = authResult.profile
// Do something with the profile
}
is AuthResult.Error -> {
// Authorization failed ⛔
// Handle the error accordingly
}
}
}
freedomID.clear()
data class GrantedProfile(
val id: String,
val identifier: String,
val email: String,
val emails: List<String>,
val nationality: String,
val phone: String,
val phones: List<String>,
val dateOfBirth: String,
val firstname: String,
val lastname: String,
val patronymic: String?,
val gender: String,
val country: String
)