Is there a way to script and download the Mojave installer without signing in to the App Store?
Something other than opening or clicking a url that points to the installer on the Mac App Store would be ideal.
There is a very well documented open source script that reads the software update catalogs and parses them for the major macOS installer components, prompts you which build and version to download and will then commence to download each portion to your filesystem and then build an installer application or image based on the options you choose.
The python script named installinstallmacos.py has this description:
A tool to download the parts for an Install macOS app from Apple's softwareupdate servers and install a functioning Install macOS app onto an empty disk image
This tool is updated for macOS 10.15 Catalina.