Android SDK
Freedom ID
Introduction
Getting Started
Prerequisites
❓ How to get API KEY and AAR?
In order to get your API KEY and AAR you need to contact Freedom Pay providing the following data:ApplicationID Signing Fingerprint from your Google Play Account
Installation Instructions
You can add the AAR via Project Structure's Dependency Tab as specified in the official docs here.
Alternatively, you can use this method:
freedom-id-sdk.aar
in the libs
directory of your app module. If the libs
directory doesn’t exist, create it at the root of your app module (e.g., app/libs
)build.gradle
file of your app module and settings.gradle
Usage
Initialize the SDK
create
method of the FreedomID
class. This method requires two parameters:
Authorize a User
authorize
method of the FreedomID
class. This method initiates the authorization flow.The
authorize
method takes three parameters:1.
FragmentManager
of the activity or fragment where the authorization flow will be displayed.2.
3.
Clear the SDK
clear
method of the FreedomID
class.This method clears the SDK's internal state and releases any resources used during the authorization process.
Authorization Flow
App Initialization
Account Check
Home Screen
, where their account(s) are displayed.Authentication Screen
to log in. After successful authentication, the user is redirected to the Home Screen
.Authentication Screen Interaction
https://passport.freedompay.kz
Home Screen Interaction
Request for Permissions
Permissions Request Screen
.User Decision
Home Screen
or informs the user that permissions are needed to proceed.Completion
Data Structures
DataGrants Structure
Each constant corresponds to a particular piece of user information, allowing the host app to selectively request access based on its needs.
Below is a table describing the different
DataGrants
available in the Freedom ID SDK:Enum Constant | Value | Description |
---|---|---|
READ_DATE_OF_BIRTH | read.data_of_birth | Grants access to the user's date of birth |
READ_FIRSTNAME | read.firstname | Grants access to the user's first name |
READ_LASTNAME | read.lastname | Grants access to the user's last name |
READ_PATRONYMIC | read.patronymic | Grants access to the user's patronymic |
READ_COUNTRY | read.country | Grants access to the user's country |
READ_NATIONALITY | read.nationality | Grants access to the user's nationality |
READ_GENDER | read.gender | Grants access to the user's gender |
READ_IDENTIFIER | read.identifier | Grants access to the user's identifier such as citizen's ID |
READ_PHONE | read.phone | Grants access to the user's phone number |
READ_EMAIL | read.email | Grants access to the user's email address |
READ_PHONES | read.phones | Grants access to the user's phone numbers |
READ_EMAILS | read.emails | Grants access to the user's email addresses |
GrantedProfile Structure
GrantedProfile
data class represents a user's profile information that is accessible after the required read permissions have been granted by the host application via the SDK.
AuthResult Structure
AuthResult
is a sealed interface representing the result of an authentication process. It has two primary branches:Table 1: AuthResult
Type | Details |
---|---|
Error | Describes various authentication errors. |
Success | A successful result containing a GrantedProfile object. |
Table 2: Error
(Subtype of AuthResult
)
Type | Details |
---|---|
ParsingError | Indicates an error during parsing. |
IncorrectApiKey | Indicates an invalid API key. |
ComponentValidationError | Represents a component validation error. |
DataProcessingError | Indicates an error in data processing. |
UtilityError | Represents a general utility error. |
TransmissionError | Contains a TransmissionGrants object. |
Network | Contains a NetworkError object. |
AccessDenied | Indicates access denial. |
ConfigurationError | Represents a configuration error. |
AuthError | Indicates a general authentication error. |
Unknown | Represents an unknown error type. |
UserCancelled | Indicates that the user cancelled the operation. |
DataGrantsCannotBeEmpty | Indicates that the data grants array is empty. |
TransmissionErrors Structure
TransmissionErrors
enum defines a set of possible errors that can occur during the transmission of requests in an authentication or communication process.Each error represents a specific issue related to the request's structure, identification, application integrity, or the process of sending and receiving requests.
Table: TransmissionErrors
Value | Details |
---|---|
INCORRECT_REQUEST_STRUCTURE | Indicates that the request structure is invalid or constructed incorrectly. |
IDENTIFICATION_ERROR | Represents an issue with identifying the request sender. |
APP_INTEGRITY_ERROR | Occurs when the application's integrity cannot be verified. |
AUTHENTICATION_FAILED | Indicates a failure in authenticating the request or sender. |
REQUEST_SENDING_ERROR | Represents an error that occurred while sending the request. |
REQUEST_RECEIVING_ERROR | Represents an error that occurred while receiving the request. |
NetworkError Structure
NetworkError
sealed interface defines a set of possible errors that may occur during network operations.Each subtype of
NetworkError
represents a specific issue, such as connection failures, stream interruptions, or problems with request/response handling.Table: NetworkError
Type | Description |
---|---|
ConnectionError | Indicates a failure to establish a network connection. |
StreamError | Represents an issue with the data stream during transmission. |
CodeError | Occurs when the response contains an unexpected or invalid status code. |
BodyError | Indicates a problem with the response body, such as being incorrectly constructed or missing. |
UnknownError | Captures any unspecified or unexpected network error. |
Support
If you have questions or need help, feel free to reach out! 👋
Modified at 2025-03-20 07:45:10