LogOut with code

Summary

A log out button is wanted inside a Retool app so that clicking it signs the current user out, equivalent to closing the browser tab and returning them to the login page.

AI Response

This is achievable in a classic Retool app without any special component. Add a Button, then configure a click event handler that runs the utils.openUrl() action pointing to your org's logout URL (https://YOURORG.retool.com/logout). Opening that URL ends the session and returns the user to the login screen. Substitute your actual subdomain in place of YOURORG.

Sources

:bookmark: How do I get my operator to Exit from my App
Solved topic covering the same request, with the exact workaround: a button that calls utils.openUrl() to the org's /logout URL to sign the user out and return them to the login page.
:bookmark: How can a user Logout of Retool Portal
Solved topic confirming that navigating to the /logout URL is the supported way to log a user out from within an app.

The Community Team is testing out a new automation. Let us know if it's helpful (or not) by leaving a :heart:, :+1:, or :-1:. Or by marking this post as the "Solution"! Let us know if you have any feedback here. :rocket: