Страница авторизации партнерского сервиса
Authorization: Basic base64encode("{CLIENT_ID}:{CLIENT_SECRET}")
{
"redirect_uri": "https://example.com/login",
"grants": [
"read.email",
"read.phone",
"read.date_of_birth",
"read.firstname",
"read.lastname",
"read.gender",
"read.nationality",
"read.profile",
"read.country"
]
}
{
"redirect_uri": "https://passport.freedompay.kz/login?track_id=ac22c50c-22c7-4aeb-9160-e59b735f9c44&expire_at=1727246098"
}
{
"error": {
"message": "Error validating transmitted data.",
"errors": {
"grants": [
"The Grants field is required."
]
}
}
}
Authorization: Basic base64encode("{CLIENT_ID}:{CLIENT_SECRET}")
{
"authorization_code": "your_authorization_code"
}
{
"access_token": "your_access_token",
"refresh_token": "your_refresh_token",
"access_expire_at": "2024-10-02T10:52:21.000000Z",
"refresh_expire_at": "2024-10-25T10:52:21.000000Z"
}
{
"error": {
"message": "Invalid authorization_code.",
"code": 100101
}
}
Authorization: Beareer {client_access_token}
{
"id": "user_id",
"firstname": "user_firstname",
"lastname": "user_lastname",
"date_of_birth": "user_date_of_birth",
...
}
Authorization: Bearer refresh_token
{
"access_token": "new_access_token",
"refresh_token": "new_refresh_token",
"access_expire_at": "new_expiration_time",
"refresh_expire_at": "new_expiration_time"
}
Authorization: Beareer {client_access_token}
{
"request_id": "UUID",
"created_at": "2024-10-17T12:00:00Z"
}
{
"request_id": "string",
"status": "accepted",
"freedom_id": "UUID"
}
Authorization: Beareer {client_access_token}
{
"request_id": "string"
}
{
"request_id": "string",
"status": "completed",
"freedom_id": "UUID",
"profile": {
...
},
"datetime": "2024-10-17T12:10:00Z"
}
// 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
)
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 = ""
}