Skip to main content

SignIn

SignIn is a pre-built Flutter widget that drives the full sign-in loop using the ThunderID Flow Execution API. It renders the appropriate input form for each authentication step (username/password, TOTP, email OTP, etc.) and automatically advances through the flow until completion.

import 'package:thunderid_flutter/thunderid_flutter.dart';

SignIn(
applicationId: '<your-application-id>',
onComplete: () {
// Refresh state after sign-in
ThunderIDProvider.of(context).refresh();
},
onError: (error) => print('Sign in failed: $error'),
)

SignIn Parameters

ParameterTypeRequiredDescription
applicationIdStringThe Application ID from the ThunderID console. Used to initiate the Flow Execution API.
onCompleteVoidCallback?Called when the sign-in flow completes successfully.
onErrorvoid Function(dynamic)?Called if the flow fails or an error occurs. Receives the raw error.

BaseSignIn

BaseSignIn exposes the raw SignInState to your builder function, allowing full control over the form UI while the SDK manages the flow execution loop.

BaseSignIn(
applicationId: '<your-application-id>',
onComplete: () => ThunderIDProvider.of(context).refresh(),
builder: (context, state) {
return Column(
children: [
for (final input in state.inputs)
TextField(
decoration: InputDecoration(labelText: input.label),
obscureText: input.type == 'password',
onChanged: (value) => state.setValue(input.name, value),
),
ElevatedButton(
onPressed: state.isLoading ? null : state.submit,
child: state.isLoading
? const CircularProgressIndicator()
: const Text('Sign In'),
),
if (state.error != null) Text(state.error!),
],
);
},
)

BaseSignIn Parameters

ParameterTypeRequiredDescription
applicationIdStringThe Application ID for the flow.
onCompleteVoidCallback?Called on successful completion.
onErrorvoid Function(dynamic)?Called on failure.
builderWidget Function(BuildContext, SignInState)Builder receiving the current SignInState. Called on every state change.

SignInState

SignInState is passed to the BaseSignIn builder on every update.

Inputs

PropertyTypeDescription
inputsList<FlowInput>Form fields for the current step. Each has name, label, type ('text', 'password', 'otp'), required, and value.
actionsList<FlowAction>Available actions for the current step (e.g., "Forgot Password"). Each has name, label, and type.

State

PropertyTypeDescription
isLoadingbooltrue while a flow step is executing.
errorString?Human-readable error from the last step. null when no error.
flowStatusFlowStatusCurrent flow status: idle, promptOnly, complete, or error.

Methods

MethodDescription
setValue(name, value)Set a field value. Binds the input named name to value.
submit()Submit the current step. Advances the flow.
executeAction(action)Execute a FlowAction (e.g., trigger a "Resend OTP" action).
ThunderID LogoThunderID Logo

Product

DocsAPIsSDKs
© WSO2 LLC. All rights reserved.Privacy PolicyCookie Policy