logout method

Future<void> logout(
  1. {String? returnTo}
)

Redirects the user to the Auth0 Logout endpoint to remove their authentication session, and log out. The user is immediately redirected back to the application once logout is complete.

If returnTo is not specified, a default URL is used that incorporates the domain value specified to Auth0.new, and the custom scheme on Android, or the bundle identifier in iOS. returnTo must appear in your Allowed Logout URLs list for the Auth0 app. Read more about redirecting users after logout.

Implementation

Future<void> logout({final String? returnTo}) async {
  await Auth0FlutterWebAuthPlatform.instance.logout(_createWebAuthRequest(
    WebAuthLogoutOptions(returnTo: returnTo, scheme: _scheme),
  ));
  await _credentialsManager?.clearCredentials();
}