logoutUser function

Future<void> logoutUser({
  1. required String auth0Domain,
  2. required String auth0ClientId,
  3. required String redirectUri,
  4. String? scheme,
})

Logs out user (via universal login) on mobile.

Implementation

Future<void> logoutUser({
  required String auth0Domain,
  required String auth0ClientId,
  required String redirectUri,
  String? scheme,
}) async {
  Auth0 auth0 = initAuth0Mobile(
    auth0Domain,
    auth0ClientId,
  );

  try {
    scheme != null
        ? await auth0.webAuthentication(scheme: scheme).logout()
        : await auth0.webAuthentication().logout();
  } catch (e) {
    throw Exception(e);
  }
}