Interface LogoutOptions

interface LogoutOptions {
    clientId?: null | string;
    logoutParams?: {
        federated?: boolean;
        returnTo?: string;
        [key: string]: any;
    };
    onRedirect?: ((url) => Promise<void>);
    openUrl?: false | ((url) => void | Promise<void>);
}

Hierarchy

Properties

clientId?: null | string

The clientId of your application.

If this property is not set, then the clientId that was used during initialization of the SDK is sent to the logout endpoint.

If this property is set to null, then no client ID value is sent to the logout endpoint.

Read more about how redirecting after logout works

logoutParams?: {
    federated?: boolean;
    returnTo?: string;
    [key: string]: any;
}

Parameters to pass to the logout endpoint. This can be known parameters defined by Auth0 or custom parameters you wish to provide.

Type declaration

  • [key: string]: any

    If you need to send custom parameters to the logout endpoint, make sure to use the original parameter name.

  • Optional federated?: boolean

    When supported by the upstream identity provider, forces the user to logout of their identity provider and from Auth0. Read more about how federated logout works at Auth0

  • Optional returnTo?: string

    The URL where Auth0 will redirect your browser to after the logout.

    Note: If the client_id parameter is included, the returnTo URL that is provided must be listed in the Application's "Allowed Logout URLs" in the Auth0 dashboard. However, if the client_id parameter is not included, the returnTo URL must be listed in the "Allowed Logout URLs" at the account level in the Auth0 dashboard.

    Read more about how redirecting after logout works

onRedirect?: ((url) => Promise<void>)

Type declaration

    • (url): Promise<void>
    • Used to control the redirect and not rely on the SDK to do the actual redirect.

      Parameters

      • url: string

      Returns Promise<void>

      Example

      await auth0.logout({
      async onRedirect(url) {
      window.location.replace(url);
      }
      });

      Deprecated

      since v2.0.1, use openUrl instead.

openUrl?: false | ((url) => void | Promise<void>)

Used to control the redirect and not rely on the SDK to do the actual redirect.

Set to false to disable the redirect, or provide a function to handle the actual redirect yourself.

Type declaration

    • (url): void | Promise<void>
    • Parameters

      • url: string

      Returns void | Promise<void>

Example

await auth0.logout({
openUrl(url) {
window.location.replace(url);
}
});

Example

import { Browser } from '@capacitor/browser';

await auth0.logout({
async openUrl(url) {
await Browser.open({ url });
}
});