Verify if user is authenticated with Custom API

I implemented custom API authentication as detailed here: Custom API authentication and it works great!
The only issue is that users sometimes forget to the click the "Login with My Admin API" button before attempting other actions, and then those actions fail mysteriously. Nearly every user experiences this frustration which has made it challenging to roll out Retool more broadly.
Is there a way to determine whether a user is logged in to the custom API, so if they're not logged in I can display a message and/or disable the buttons that require authentication? This could be a Globals value, maybe on the current_user object.

Hey there! Yes, what you’ll need to do is supply a login test url (scroll to the bottom of your API resource to configure this). We will automatically call this endpoint upon app load, and if it returns a non-20X status code (i.e. a non-successful status code like 401 unauthorized or something) then we will automatically prompt the user for login

Thanks David, works great! Should save a lot of confusion.