After reverting everything back to its original and redeploying to the Mendix Cloud, the Sign Out button is working as expected.
The functionality you require is exactly the functionality that MendixSSO offers:
- when arriving the first time on the login page, you see the Mendix SSO login button;
- clicking that button logs you in, if you are logged in to Mendix. If you are not logged in to Mendix, you will see the Mendix-login page;
- closing the browser and opening it again, returning to the application url will log you in again;
- clicking the logout button will log you out locally and show you your login page, including the MendixSSO login button
Where did the SSO-implementing go wrong? It seems to function fine, since you can log in according to your description.