Check if a user is logged into APEX, or whether they are visiting as a public user.
This is the underlying PLSQL that the built in APEX condition called “User is the public user (user has not authenticated)” uses.
if apex_application.public_role_check (
p_role => ‘MUST_NOT_BE_PUBLIC_USER’ )
— session is authenticated