Installation
Add InsForge to your Swift Package Manager dependencies:Enable Logging (Optional)
For debugging, you can configure the SDK log level and destination:
Log Destinations:
Use
.info or .error in production to avoid exposing sensitive data in logs.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 havehasSession = true. - 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 = niluser = nilneedsEmailVerification = true
Related methods
signIn()
Sign in an existing user with email and password.Parameters
email(String) - User’s email addresspassword(String) - User’s password
Example
Email verification
If the sign in response is:signOut()
Sign out the current user.Example
getCurrentUser()
Get authenticated user with profile data.Example
setProfile()
Update current user’s profile.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
ResetPasswordTokenResponse
Example
resetPassword()
Reset the user’s password using a reset token.Parameters
otp(String) - Reset token (fromexchangeResetPasswordToken()for code flow, or from magic link URL for link flow)newPassword(String) - New password meeting the configured requirements
Example
signInWithOAuthView()
Sign in directly with a specific OAuth provider. This method opens the OAuth provider’s authentication page directly. On iOS 12+ and macOS 10.15+, the SDK usesASWebAuthenticationSession to present an in-app authentication browser with automatic callback handling.
Supported providers
Parameters
provider(OAuthProvider) - The OAuth provider to authenticate withredirectTo(String) - Callback URL where InsForge will redirect after authentication
Returns
AuthResponse containing the authenticated user and session tokens.
Authentication flow
Example
URL scheme configuration
Register a callback URL for your app, pass that exact value toredirectTo, and add the same value to allowedRedirectUrls in Auth Settings. For example, you can use a deep link such as yourapp://auth/callback or a claimed HTTPS callback such as https://app.example.com/auth/callback. Requests fail with HTTP 400 if redirectTo is not allowlisted.