What do you need to do with the downloaded file? The codeless logic you shared sends a request to grab the file but doesn’t do anything with the file. Is the intent to let the user save the file locally?
Please note that checking for the current user does not prevent non-logged-in users from trying to open the file directly via the URL. However, you already have permissions set up to deny access to this file for all users except authenticated ones. This check is only needed to show a message to the user instead of opening the file in a new tab with a message that is not user-friendly.
IMPORTANT: When you use the login API, make sure the API request is sent to the same subdomain/domain from which you fetch the file. You can control that on the SETTINGS tab in UI Builder: