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 web.

Implementation

Future<void> logoutUser({
  required String auth0Domain,
  required String auth0ClientId,
  required String redirectUri,
  String? scheme,
}) async {
  auth0_web.Auth0 auth0 = await initAuth0Web(
    auth0Domain: auth0Domain,
    auth0ClientId: auth0ClientId,
    redirectUri: redirectUri,
  );

  try {
    auth0.logout(
      options: LogoutOptions(
        returnTo: redirectUri,
      ),
    );
  } catch (e) {
    throw Exception(e);
  }
}