---
updatedAt: 2026-03-02T11:14:23.000Z
---

# Authentication

# ENGAGE® SDK Authentication

Authenticating the host app with the ENGAGE platform is required to validate the communication between the device and platform.

The following authentication mechanisms are possible:

* Silent Registration (PUSH or PIN): Auto resolves in the background and does not require user interaction
* SMS: Requires user interaction to verify a PIN via SMS

<br />

***

## Step 1. Configure ENGAGE Plugin

Configure the ENGAGE Plugin for **iOS platform** only before starting the app in the `main.dart`.

Use **await** at method call with the combination of **async** keyword in front of the function body to declare an asynchronous function in Dart and Flutter.

> 📘
>
> **NOTE:** `EngageEnvironment.debug` and `group.your-app-group-id` are specific parameters used in iOS configuration. Since they are not relevant for Android, passing **null** for these parameters is acceptable and will not affect the functionality on Android platforms.

```javascript Dart
import 'package:flutter/material.dart'; 
import 'package:flutter_engage_plugin/engage.dart'; 
import 'package:flutter_engage_plugin/utils/const.dart'; 

void main() async {
  
  // Ensure that Flutter widgets are initialized.
  WidgetsFlutterBinding.ensureInitialized();
 
  // Initialize the Engage SDK for only ios platform
	if(Platform.isIOS){
    await Engage.instance.configureEngageForIOS(EngageEnvironment.production, "group.your-app-group-id");
	}
 
  // Run the Flutter application.
  runApp(const MyApp());
}
```

> 📘 Note:
>
> Initialize the Engage SDK for only iOS platform only in **main.dart** and for Android initialization will be in **Automatically Initialized**

## Step 2. Handlers

There is one main interface that the host app can implement that allows them to receive callbacks for certain actions involved in registration.

### EngageRegistrationHandler

```javascript Dart
abstract class EngageRegistrationHandler {
 /// Called when challenge is initialized successfully
 void onInitializationSuccess(String? userNumber);

 /// Called when number is registered successfully
 void onRegistrationSuccess(String? userNumber);

 /// Called when registration fails
 /// @param phoneNumber Phone number that failed to register
 /// @param error The reason of the error
 void onRegistrationFailure(
     String? phoneNumber, EngageRegistrationError? error);
}

```

<br />

## Step 3. Registration

To register a phone number, pass the phone number along with `EngageResigistationHandler` callback:

```javascript Dart
   Engage.instance.register(phoneNumber: number, engageRegistrationHandler: this);
```

<br />

> 📘
>
> **NOTE:** If the SMS registration is used, the 6-digit code delivered in the SMS needs to be passed to ENGAGE:
>
> ```javascript Dart
>    Engage.instance.completeChallengeWithCode(code, (usernumber) => {print('sms verify')});
> ```