Android
Library that provides a set of Authentication screens and flows required to build new products.
Getting Started
- Example
- Installing
- Readme
- Changelog
This libarary provides two options for authentication flow UI and Manual
- UI
- Manual
- Listeners
HumaAuthManager.getInstance().registerAuthResult(this)
To start UI flow you need to call:
HumaAuthManager.getInstance().openAuthUI {
// this callback will be called when user is signed in
}
First step for the manual authenitification should be getting current status of the user.
Get current user auth status
HumaAuthManager.getInstance().getAuthStep { step ->
when (step) {
AuthStep.SIGN_UP_AND_SIGN_IN -> {
//ready to be signed it
}
AuthStep.SIGN_UP_MFA -> {
//need to continue registration flow with enter phone step HumaAuthManager.getInstance().setPhone(email,phone)
}
AuthStep.HOME -> {
//user is signed in
}
}
}
Get available regions
HumaAuthManager.getInstance().regions { regions ->
//selected region must be set to HumaAuthManager.getInstance.setRegion(region)
}
Set region
HumaAuthManager.getInstance().setRegion(region)
Validate activation code
HumaAuthManager.getInstance().verifyActivationCode(code) { boolean ->
//if true then code is valid
}
Start sign up process
HumaAuthManager.getInstance().signUp(email, activationCode) { status, error ->
//if status is true, verification code will be send on entered email
}
Start sign in process
HumaAuthManager.getInstance().signIn(email) { signInStatus, error ->
//if signInStatus is SignInStatus.EMAIL_VERIFICATION_REQUIRED then should verify your email
//if signInStatus is SignInStatus.ENTER_PASSWORD then you should enter password
}
Verify email
HumaAuthManager.getInstance().verifyEmail(email, code) { signInStatus, error ->
//if signInStatus is SignInStatus.SET_PASSWORD then you need to set password for user
}
Set Email
HumaAuthManager.getInstance().setPassword(email, password) { signInStatus, error ->
//if signInStatus is SignInStatus.SIGNED_IN then you are signed in
//if signInStatus is SignInStatus.MFA_REQUIRED then you need enter mfa code that was send to your phone
//if signInStatus is SignInStatus.PHONE_VERIFICATION_REQUIRED then you need to set your phone
}
MFA
HumaAuthManager.getInstance().confirmMfa(code) { signInStatus, error ->
//if signInStatus is SignInStatus.SIGNED_IN then you are signed in
}
Set phone
HumaAuthManager.getInstance().setPhone(email, phone) { send, error ->
//if send is true then code to validate account is set
}
Verify phone
HumaAuthManager.getInstance().verifyPhone(email, phone, code) { signInStatus, error ->
//if signInStatus is SignInStatus.SIGNED_IN then you are signed in
}
Enter password
HumaAuthManager.getInstance().enterPassword(email, password) { signInStatus, error ->
//if signInStatus is SignInStatus.SIGNED_IN then you are signed in
//if signInStatus is SignInStatus.MFA_REQUIRED then you are required to enter mfa
}
Forgot password
HumaAuthManager.getInstance().forgotPassword(email) { boolean, error ->
//if boolean is true then reset link is send
}
Is user signed in
HumaAuthManager.getInstance().isSignedIn() { boolean ->
//if boolean is true then user is signed in
}
Logout
HumaAuthManager.getInstance().logout(LogoutType){ //LogoutType is optional
//on logout complete
}
Listen for sign out event
HumaAuthManager.getInstance().registerLogoutListener { type: LogoutType ->
//type defines what caused logout
}
Add the dependency in your local build.gradle file:
implementation("com.huma.sdk:auth:latest-version")
HumaAuthManager
require dependencies to be initialized before it inApplication
classHumaUtilsManager.init(/*..*/)
HumaUiManager.init(/*..*/)
HumaSharedManager.init(/*..*/)
HumaCachingManager.init(/*..*/)
HumaAuthManager.init(/*..*/)
HumaAuthManager - main class to interact with durning library usage
Authentication - library provides two types on authentication flows.
- UI - where users will be presented with prebuild interface for SignIn/SignUp
- Manual - where library user required to build ui to interact wih manager
Documentation
[0.1.29]
- #5 Added manual and UI flow for authentication