Installation
- Add InsForge dependencies to your project
- Maven Central
- GitHub Packages
build.gradle.kts:
- Initialize InsForge SDK
- Enable Logging (Optional)
Use
NONE or ERROR in production to avoid exposing sensitive data in logs.Android Initialization
- Add Chrome Custom Tabs dependency to your
build.gradle.kts:
- Initialize InsForge SDK (With Chrome Custom Tabs and Session Storage)
- Use Jetpack DataStore for Session Storage (Optional)
signUp()
Create a new user account with email and password.Parameters
email(String) - User’s email addresspassword(String) - User’s passwordname(String?, optional) - User’s display name
Returns
SignUpResponse
Example (Complete Flow with Verification)
Email Verification
For users who register with email, the InsForge backend provides three options:- No email verification - Users can sign in immediately after registration.
SignUpResponsewill haveaccessToken != null. - Link-based verification - Users must open their email and click the verification link before they can sign in.
- Code-based verification - The InsForge backend sends a 6-digit verification code to the user’s email. The client app needs to display a verification screen where users can enter the code, then call
verifyEmail(email, code)to complete verification. Only after this can users sign in with email + password.
requireEmailVerification is true, the response will have:
accessToken = nulluser = nullrequireEmailVerification = true
Related Methods
signIn()
Sign in an existing user with email and password.Example
Email Verification
If the sign in response is:signOut()
Sign out the current user.Example
signInWithOAuthPage()
Sign in directly with a specific OAuth provider. This method opens the OAuth provider’s authentication page directly in the system browser.Supported Providers
Parameters
provider(OAuthProvider) - The OAuth provider to authenticate withredirectUri(String) - Callback URL where InsForge will redirect after authentication
Returns
Example
- Configure BrowserLauncher
browserLauncher to handle opening URLs:
- Configure App Link / Deep Link Callback
- Option A: Custom URL Scheme (for Development)
- Option B: App Links (for Production)
- Initiate OAuth Login with Specific Provider
- Handle OAuth Callback
client should come from the same shared InsForge client instance you use elsewhere in the app, such as an Application singleton or your DI container.
getCurrentUser()
Fetch the current authenticated user from the server. This is a suspend function that makes a network request.Returns
Example
This method makes a network request to fetch user data. For accessing locally cached user state, use
currentUser StateFlow instead.updateProfile()
Update current user’s profile.Parameters
profile(Map\<String, Any\>) - Profile fields to update
Returns
Example
Password Reset
InsForge supports two password reset methods, configured in the backend:- Code method: User receives a 6-digit code via email, verifies it to get a reset token, then resets password
- Link method: User receives a magic link via email containing the reset token, then resets password directly
sendPasswordReset()
Send a password reset email to the user. The email will contain either a 6-digit code or a magic link depending on the backend configuration.Parameters
email(String) - User’s email address
Example
exchangeResetPasswordToken()
Exchange a 6-digit reset code for a reset token. This method is only used with the code-based reset flow.Parameters
email(String) - User’s email addresscode(String) - 6-digit numeric code received via email
Returns
ResetTokenResponse
Example
resetPassword()
Reset the user’s password using a reset token.Parameters
newPassword(String) - New password meeting the configured requirementsotp(String) - Reset token (fromexchangeResetPasswordToken()for code flow, or from magic link URL for link flow)