--- title: "system.perspective.login" description: "Triggers a login event that will allow the user to log in with the project's configured Identity Provider (IdP)." --- # system.perspective.login > Triggers a login event that will allow the user to log in with the project's configured Identity Provider (IdP). This function is used in **Python Scripting**. ## Description Triggers a login event that will allow the user to log in with the project's configured Identity Provider (IdP). For this function to work, an IdP must be set in Perspective [Project properties](ignition-modules\perspective\perspective-project-properties.md). This is particularly useful when you want it to be possible to start a session without authentication and sign in to access certain restricted features. Note that calling this function after a user is already logged in will **not** log out the previous user. :::caution Be advised that this function should not be used in the same script, or in the same triggering event as [system.perspective.logout](appendix\scripting-functions\system-perspective\system-perspective-logout.md). Logging in and Logging out should always be triggered by separate events. ::: ## Syntax `system.perspective.login([sessionId], [pageId], [forceAuth])` ### 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] Boolean | `forceAuth` | Determines if Ignition should ask the IdP to re-authenticate the user, even if the user is already signed into the IdP. If set to true, then the IdP will ask the user to re-enter their credentials. If set to false, then the Gateway will request that the IdP use the last provided credentials for the Session, potentially allowing re-authentication without requiring the user to re-type their credentials. Note that support for this argument is determined by the IdP; the IdP may choose to ignore this request. If this parameter is omitted, then the function will use the re-authentication setting defined under [Project properties](platform\designer\project-properties\project-properties.md#security-settings). [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="Force Authentication" # When forceAuth is True, the user will always be required to type in their credentials, even if they're already logged in. system.perspective.login(forceAuth=True) ```