https://docs.appsmith.com/reference/appsmith-framework/widget-actions/logout-user • 49 KB fetchedOpen original page
logoutUser() | Appsmith Skip to main content Ask AI Search Ask Appsmith AI Submit message Examples How do I install Appsmith using Docker? How do I connect to my local PostgreSQL database? How do I pass inputs from a widget to a query? How do I trigger multiple queries conditionally? How do I fix the error: This value does not evaluate to type Array<Object>? Try Appsmith * Get Started * Introduction * Build Your First App * Self Hosting * New Installation Guides * Manage Installation * Upgrade Installation Guides * Concepts * Connect Data * Overview * How-to Guides * Reference * Datasources * Query Settings * Concepts * Build Apps * Overview * Quickstart * How-to Guides * Reference * Widgets * Accessibility * Theme * Sample Apps * Write Code * Overview * How-to Guides * Reference * Global Objects * Global Functions * clearInterval() * clearStore() * closeModal() * copyToClipboard() * download() * logoutUser() * navigateTo() * postWindowMessage() * removeValue() * resetWidget() * setTimeout() * setInterval() * storeValue() * showAlert() * showModal() * unlistenWindowMessage() * windowMessageListener() * JS Libraries * Fetch API * Data Transformation * JavaScript Settings * Concepts * Best Practices * Manage Apps and Users * Authentication * Granular Access Control * Versioning with Git * Setup SCIM Provisioning * Embed Appsmith * Migrate Applications * Audit Logs * Branding * External Client Portal * Packages * Overview * Tutorial * How-to Guides * Reference * Package Version Control * GIT Apps with Packages Best Practices * Code Packages * UI Packages * Workflows * Overview * Tutorial * How-to Guides * Reference * Workflow Triggers * Workflow Queries * Workflow Functions * Pass Parameters to Workflows * Run History * Troubleshooting * Overview * Self-hosting Errors * Application Errors * Product * FAQ * Security * Telemetry * Support at Appsmith * Privacy Policy * Release Notes * Contribute © 2026 Appsmith, Inc. * * Write Code * Reference * Global Functions * logoutUser() On this page logoutUser() This page provides information about the logoutUser() function, which allows users to implement custom logout functionality and specify redirection behavior after logging out. logoutUser() Signature logoutUser ( redirectUrl ? : string ) : void Parameters Below are the parameters required by the logoutUser() function to execute: redirectUrl string Specifies the URL where the user should be redirected after logging out. If not provided, the user is redirected to /user/login , with the default redirection set to the current page. Usage Here are a few examples of using logoutUser() in different situations: Logout and redirect to current page Logs out the user and redirects them back to the same page after login. This is useful when users should return to their previous location without needing a manual redirect. logoutUser ( ) ; Logout and redirect to same page Ensures that users always return to the exact page they logged out from by explicitly setting the redirect URL to the current page. logoutUser ( appsmith . URL . pathname ) ; This redirects the user to /user/login?redirectUrl=<current_path> , allowing them to resume from where they left off. Logout and redirect to custom page Logs out the user and redirects them to a predefined page, such as a dashboard or a specific section of the application. logoutUser ( "/app/abc" ) ; This directs the user to /user/login?redirectUrl=/app/abc , ensuring that after login, they land on the specified page instead of the default applications page. Was this page helpful? Edit this page Previous download() Next navigateTo() * Signature * Usage