Open android → app → src → main → AndroidManifest.XML, , add the following snippet, and replace android:scheme and android:host with your app's values:
bool isLocal =
false; // To confirm if you running your project locally or using main-net. Change it to true if running locallyService idlService =
FieldsMethod.idl; // Idl service (Location: lib/integration.dart)String backendCanisterId =
'cni7b-uaaaa-aaaag-qc6ra-cai'; // Replace it with your backend canisterIdString middlePageCanisterId =
'nplfj-4yaaa-aaaag-qjucq-cai'; // Replace it with your middlePage canisterId
isLoggedIn and _principalId are used to change the state of the log in/log out button and principal text. You can modify them according to your applications need.
Future<void> _manualLogin(Uri uri) async {
List<dynamic> result = awaitAuthLogIn.fetchAgent(
uri.queryParameters, isLocal, backendCanisterId, idlService);
if (result.isNotEmpty) {
setState(() {
isLoggedIn = uri.queryParameters['status'] == "true" ? true : false;
_principalId = result[0];
});
} else {
setState(() {
isLoggedIn = false;
_principalId = "Log in to see your principal";
});
}
}
3. Using the IIDLogin Button
When passing argument in the IIDLogin button, remember to pass your app:host and app:callback:
For login button call:
Replace the argument host and scheme with your app's host and scheme