logout method
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 on iOS/macOS. returnTo
must appear in your
Allowed Logout URLs list for the Auth0 app.
Read more about redirecting users after logout.
useHTTPS
(iOS/macOS only) controls whether to use https
as the scheme
for the return URL on iOS 17.4+ and macOS 14.4+. When set to true
, the
bundle identifier of the app will be used as a custom scheme on older
versions of iOS and macOS. Requires an Associated Domain configured with
the webcredentials
service type, set to your Auth0 domain –or custom
domain, if you have one.
Implementation
Future<void> logout(
{final String? returnTo, final bool useHTTPS = false}) async {
await Auth0FlutterWebAuthPlatform.instance.logout(_createWebAuthRequest(
WebAuthLogoutOptions(
returnTo: returnTo, scheme: _scheme, useHTTPS: useHTTPS),
));
await _credentialsManager?.clearCredentials();
}