Skip to main content

Installation

  1. Add InsForge dependencies to your project
build.gradle.kts:
  1. Initialize InsForge SDK
  1. Enable Logging (Optional)
For debugging, you can configure the SDK log level:
Use NONE or ERROR in production to avoid exposing sensitive data in logs.

Android Initialization

  1. Add Chrome Custom Tabs dependency to your build.gradle.kts:
  1. Initialize InsForge SDK (With Chrome Custom Tabs and Session Storage)
  1. Use Jetpack DataStore for Session Storage (Optional)

signUp()

Create a new user account with email and password.

Parameters

  • email (String) - User’s email address
  • password (String) - User’s password
  • name (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:
  1. No email verification - Users can sign in immediately after registration. SignUpResponse will have accessToken != null.
  2. Link-based verification - Users must open their email and click the verification link before they can sign in.
  3. 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.
When requireEmailVerification is true, the response will have:
  • accessToken = null
  • user = null
  • requireEmailVerification = true
This indicates that verification via option 2 or 3 is required before the user can sign in.

signIn()

Sign in an existing user with email and password.

Example

Email Verification

If the sign in response is:
This indicates that verification via option 2 or 3 (link or code, see signUp()) is required before the user can sign in.

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 with
  • redirectUri (String) - Callback URL where InsForge will redirect after authentication

Returns

Example

  1. Configure BrowserLauncher
When creating the InsForge client, configure the browserLauncher to handle opening URLs:
  1. Configure App Link / Deep Link Callback
Configure your callback Activity in AndroidManifest.xml:
  • Option A: Custom URL Scheme (for Development)
  • Option B: App Links (for Production)
  1. Initiate OAuth Login with Specific Provider
  1. 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 address
  • code (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 requirements
  • otp (String) - Reset token (from exchangeResetPasswordToken() for code flow, or from magic link URL for link flow)

Example


Error Handling

Common Error Codes