--- title: "system.perspective.logout" description: "Triggers a logout event, which will log the user out." --- # system.perspective.logout > Triggers a logout event, which will log the user out. This function is used in **Python Scripting**. ## Description Triggers a logout event, which will log the user out. For this function to work, an Identity Provider (IdP) must be set in the [Perspective Project properties](ignition-modules\perspective\perspective-project-properties.md). :::caution Be advised that this function should not be used in the same script, or in the same triggering event as [system.perspective.login](appendix\scripting-functions\system-perspective\system-perspective-login.md). Logging in and Logging out should always be triggered by separate events. ::: ## Syntax `system.perspective.logout([sessionId], [pageId], [message])` ### Parameters Type | Parameter | Description ------- | ------- | ------ String | `sessionId` | Identifier of the Session to target. If omitted, the current Session will be used automatically. When targeting a different Session, then the pageId parameter must be included in the call. [optional] String | `pageId` | Identifier of the Page to target. If omitted, the current Page will be used automatically. [optional] String | `message` | The message to display when the user logs out of their session. This message is only shown when the project requires authentication. If omitted, the default message (set in [Project Properties](ignition-modules\perspective\perspective-project-properties.md#perspective-general-properties)) is shown. [Optional] ### Returns Nothing ### Scope Gateway, Perspective Session :::note This function will only work in the Gateway scope if both `sessionId` and `pageId` are supplied to the call. ::: ## Code Examples ```python title="Code Snippet" # This example is a script on a Button component and will log the current user out. system.perspective.logout() ```