Indefinite loading issue

When asking for help in this category, please make sure to provide the following details:

  • SDK Version: 6.2.0

  • Platform: Android

  • Browser Console Screenshots:

  • If the issue is related to Custom Authentication, please include the following information (optional):

    • Verifier Name: w3a-aggregate-verifier
    • JWKS Endpoint:
    • Sample idToken (JWT): NA
import 'dart:collection';
import 'dart:io';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:web3auth_flutter/enums.dart';
import 'package:web3auth_flutter/input.dart';
import 'package:web3auth_flutter/web3auth_flutter.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> with WidgetsBindingObserver {
  int _counter = 0;

  @override
  void initState() {
    super.initState();
    initPlatformState();
    WidgetsBinding.instance.addObserver(this);
  }

  @override
  void dispose() {
    super.dispose();
    WidgetsBinding.instance.removeObserver(this);
  }

  @override
  void didChangeAppLifecycleState(final AppLifecycleState state) {
    // This is important to trigger the on Android.
    if (state == AppLifecycleState.resumed) {
      Web3AuthFlutter.setCustomTabsClosed();
    }
  }

  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> initPlatformState() async {
    final themeMap = HashMap<String, String>();
    themeMap['primary'] = "#eb5424";

    Uri redirectUrl;
    if (Platform.isAndroid) {
      redirectUrl = Uri.parse('w3a://com.whitelabel.ncw');
    } else if (Platform.isIOS) {
      redirectUrl = Uri.parse('com.whitelabel.ncw://openlogin');
    } else {
      throw UnKnownException('Unknown platform');
    }

    final loginConfig = HashMap<String, LoginConfigItem>();
    loginConfig['jwt'] = LoginConfigItem(
      verifier: 'w3a-aggregate-verifier',
      verifierSubIdentifier: "w3a-auth0-verifier",
      typeOfLogin: TypeOfLogin.jwt,
      clientId: "ULYgWJWUwabs7n8WMLvzE9s34YW4PxGf",
    );
    loginConfig['email_passwordless'] = LoginConfigItem(
      verifier: 'w3a-aggregate-verifier',
      verifierSubIdentifier: "w3a-email-verifier",
      typeOfLogin: TypeOfLogin.email_passwordless,
      clientId:
          "BL-eRKwPFAahBn9p_EN3hXjAeF36zc94iHPtgU3k_c9QKBJlDtiE7G8gB5GThBzOlaO-X7PtUWhL1TIBO5OY6Ds",
    );

    await Web3AuthFlutter.init(
      Web3AuthOptions(
        clientId:
            'BL-eRKwPFAahBn9p_EN3hXjAeF36zc94iHPtgU3k_c9QKBJlDtiE7G8gB5GThBzOlaO-X7PtUWhL1TIBO5OY6Ds',
        network: Network.sapphire_devnet,
        redirectUrl: redirectUrl,
        whiteLabel: WhiteLabelData(
          appName: "White Label NCW",
          logoLight:
              "https://www.vectorlogo.zone/logos/flutterio/flutterio-icon.svg",
          logoDark:
              "https://cdn.icon-icons.com/icons2/2389/PNG/512/flutter_logo_icon_145273.png",
          defaultLanguage: Language.en,
          mode: ThemeModes.auto,
          appUrl: "https://web3auth.io",
          useLogoLoader: true,
          theme: themeMap,
        ),
        loginConfig: loginConfig,
        // 259200 allows user to stay authenticated for 3 days with Web3Auth.
        // Default is 86400, which is 1 day.
        sessionTime: 86400 * 30,
      ),
    );

    try {
      await Web3AuthFlutter.initialize();
    } catch (e) {
      print(e.toString());
    }
  }

  void _withAuth0(String connection, {String? email}) {
    final loginParam = email != null || connection == 'email'
        ? LoginParams(
            loginProvider: Provider.email_passwordless,
            mfaLevel: MFALevel.NONE,
            extraLoginOptions: ExtraLoginOptions(
              login_hint: email,
              display: Display.popup,
            ),
          )
        : LoginParams(
            loginProvider: Provider.jwt,
            mfaLevel: MFALevel.NONE,
            extraLoginOptions: ExtraLoginOptions(
              domain: 'https://dev-nhcp41mypd0msufj.us.auth0.com',
              verifierIdField: 'email',
              connection: connection,
              isVerifierIdCaseSensitive: false,
            ),
          );
    print('here');
    Web3AuthFlutter.login(loginParam)
        .then((response) {
          Clipboard.setData(
            ClipboardData(text: response.userInfo?.idToken ?? ''),
          );
          print(response.privKey);
        })
        .catchError((e) {
          print('error: $e');
        });
  }

  void _incrementCounter() {
    setState(() {
      _counter++;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,

        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            const Text('You have pushed the button this many times:'),
            Text(
              '$_counter',
              style: Theme.of(context).textTheme.headlineMedium,
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: () => _withAuth0('google-oauth2'),
        // onPressed: () => _withAuth0('facebook'),
        // onPressed: () => _withAuth0('apple'),
        // onPressed: () => _withAuth0('email', email: 'ritikfbd@gmail.com'),
        tooltip: 'Increment',
        child: const Icon(Icons.add),
      ),
    );
  }
}

when running on android after authentication from auth0 the web3auth loading page shows indefinitely.

Thank you for sharing the details and code snippet, Ritik! Here’s a summary of your issue for the support team:


Issue Summary

  • SDK: Web3Auth Plug and Play (PnP) Flutter SDK
  • SDK Version: 6.2.0
  • Platform: Android
  • Login Method: Custom Auth0 (aggregate verifier: w3a-aggregate-verifier)
  • Verifier Name: w3a-aggregate-verifier
  • Issue: After authenticating with Auth0 on Android, the Web3Auth loading page shows indefinitely and does not proceed.
  • Code: Provided above (with initialization and login logic)
  • Screenshot: Attached GIF of the indefinite loading
  • Redirect URL Used: w3a://com.whitelabel.ncw
  • No sample idToken/JWKS endpoint provided (not needed for this case).

Initial Suggestions

A few things to check and try while the support team investigates:

  1. Redirect URI Registration

    • Ensure w3a://com.whitelabel.ncw is registered as a valid redirect URI in your AndroidManifest.xml as well as in your Auth0 dashboard and Web3Auth dashboard.
    • See Flutter redirect URI setup
  2. Custom Tabs Handling

    • You are correctly calling Web3AuthFlutter.setCustomTabsClosed() in didChangeAppLifecycleState. Make sure this is being triggered properly when returning from Auth0.
    • Sometimes, the app may not resume as expected. Try adding debug logs inside didChangeAppLifecycleState to confirm it is invoked.
  3. Check for Errors

    • Add more logging around the Web3AuthFlutter.login() call to see if any errors are thrown or if the promise never resolves.
  4. Session Time

    • You are using a session time of 30 days. Try reducing it to the default (1 day) to see if there’s any impact.
  5. Dependencies

    • Ensure all dependencies are up to date and compatible with Web3Auth Flutter 6.2.0.

Documentation Links


If you haven’t already, please confirm:

  • That the redirect URI is set up in your AndroidManifest and with Auth0/Web3Auth dashboards.
  • If there are any errors in the Android logcat when this happens (sometimes errors do not appear in the Flutter console).

If you have already checked these, please let us know, and the support team will dive deeper!


Support Team:
All relevant details (SDK, version, platform, code, screenshot, verifier) are provided above. Please advise on next steps or known issues with aggregate verifiers and Auth0 on Flutter Android.


Let us know if you find anything new or need more guidance!

Note: This response was generated by an AI bot and may require further verification. The Web3Auth support team has tracked this issue and will be responding as soon as possible.

Additionally, we would recommend you to join our biweekly Office Hours to get this resolved even faster. Web3Auth Developer Office Hours

Found out the android intent was not correctly configured.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.