Package-level declarations

Stytch's consumer SDK makes it simple to seamlessly onboard, authenticate, and engage users. This SDK provides the easiest way for you to use Stytch on Android. With just a few lines of code, you can easily authenticate your users and get back to focusing on the core of your product.

Supported Authentication Products

  • magicLinks

    • Send/authenticate magic links via Email

  • otp

    • Send/authenticate one-time passcodes via SMS, WhatsApp, Email

  • passwords

    • Create or authenticate a user

    • Check password strength

    • Reset a password

  • sessions

    • Authenticate/refresh an existing session

    • Revoke a session (Sign out)

  • biometrics

    • Register/authenticate with biometrics

  • oauth

    • Register/authenticate with native Google OneTap

    • Register/authenticate with our supported third-party OAuth providers (Amazon, BitBucket, Coinbase, Discord, Facebook, Github, GitLab, Google, LinkedIn, Microsoft, Salesforce, Slack, Twitch, or Yahoo)

  • passkeys

    • Register/authenticate with Passkeys

  • userManagement

    • Get or fetch the current user object (sync/cached or async options available)

    • Delete factors by id from the current user

Using the Consumer SDK

The StytchClient object is your entrypoint to the Stytch Consumer SDK and is how you interact with all of our supported authentication products.

Each endpoint is explained in their respective READMEs and inline-documentation, but there are a few special methods on the StytchClient object to document here.

Configuration

As mentioned in the /README.md, before making any Stytch authentication requests, you must configure the StytchClient:

StytchClient.configure(context: Context, publicToken: String)

This configures the API for authenticating requests and the encrypted storage helper for persisting session data across app launches.

Handling Deeplinks

StytchClient.handle() is the method you call for parsing out and authenticating deeplinks that your application receives. The currently supported deeplink types are: Email Magic Links, Third-Party OAuth, and Password resets. This method returns a ../common/DeeplinkHandledStatus.kt class which details the result of the authentication call.

For Email Magic Links and Third-Party OAuth deeplinks, it will return a Handled class containing either the authenticated response or error.

For Password Reset deeplinks, it will return a ManualHandlingRequired class containing the relevant token, so that you can provide an appropriate UI to the user for resetting their password. The returned token is used for making the subsequent StytchClient.passwords.resetByEmail() call.

Any other link types passed to this method will return a NotHandled class.

Types

Link copied to clipboard
typealias AuthResponse = StytchResult<IAuthData>

Type alias for StytchResult used for authentication responses

Link copied to clipboard
typealias BiometricsAuthResponse = StytchResult<BiometricsAuthData>

Type alias for StytchResult used for Biometrics authentication responses

Link copied to clipboard

An enum representing the supported (consumer) token types that we can extract from a deeplink

Link copied to clipboard
typealias CryptoWalletAuthenticateStartResponse = StytchResult<CryptoWalletAuthenticateStartResponseData>

Type alias for StytchResult used for crypto authentication start responses

Link copied to clipboard
typealias DeleteFactorResponse = StytchResult<DeleteAuthenticationFactorData>

Type alias for StytchResult used for deleting authentication factors from a user

Link copied to clipboard
typealias LoginOrCreateOTPResponse = StytchResult<LoginOrCreateOTPData>

Type alias for StytchResult used for loginOrCreateOTP responses

Link copied to clipboard
typealias NativeOAuthResponse = StytchResult<INativeOAuthData>

Type alias for StytchResult used for Native OAuth (Google One Tap) authentication responses

Link copied to clipboard

Type alias for StytchResult used for Third Party OAuth authentication responses

Link copied to clipboard
typealias OTPSendResponse = StytchResult<OTPSendResponseData>

Type alias for StytchResult used for OTPSend responses

Link copied to clipboard
typealias PasswordsCreateResponse = StytchResult<CreateResponse>

Type alias for StytchResult used for PasswordsCreate responses

Link copied to clipboard
typealias PasswordsStrengthCheckResponse = StytchResult<StrengthCheckResponse>

Type alias for StytchResult used for PasswordsStrengthCheck responses

Link copied to clipboard
typealias SearchUserResponse = StytchResult<UserSearchResponseData>

Type alias for StytchResult

Link copied to clipboard

The StytchClient object is your entrypoint to the Stytch Consumer SDK and is how you interact with all of our supported authentication products.

Link copied to clipboard
typealias TOTPAuthenticateResponse = StytchResult<TOTPAuthenticateResponseData>
Link copied to clipboard
typealias TOTPCreateResponse = StytchResult<TOTPCreateResponseData>
Link copied to clipboard
typealias TOTPRecoverResponse = StytchResult<TOTPRecoverResponseData>
Link copied to clipboard
typealias TOTPRecoveryCodesResponse = StytchResult<TOTPRecoveryCodesResponseData>
Link copied to clipboard
typealias UpdateUserResponse = StytchResult<UpdateUserResponseData>

Type alias for StytchResult used for UpdateUser responses

Link copied to clipboard
typealias UserResponse = StytchResult<UserData>

Type alias for StytchResult used for GetUser responses

Link copied to clipboard
typealias WebAuthnAuthenticateStartResponse = StytchResult<WebAuthnAuthenticateStartData>

Type alias for StytchResult used for WebAuthn authentication responses

Link copied to clipboard
typealias WebAuthnRegisterResponse = StytchResult<WebAuthnRegisterData>

Type alias for StytchResult used for WebAuthn registration responses

Link copied to clipboard
typealias WebAuthnRegisterStartResponse = StytchResult<WebAuthnRegisterStartData>

Type alias for StytchResult used for WebAuthn authentication responses

Link copied to clipboard
typealias WebAuthnUpdateResponse = StytchResult<WebAuthnUpdateResponseData>

Type alias for StytchResult used for WebAuthn update responses