How can I sign in on the Mac App Store with my Apple ID using the Terminal?
Currently mas does not support the signin command on Mojave.

No other purely Terminal-based method exists at the moment. There is none delivered with Mojave from Apple, nor does one exist currently as a third-party program.

However, you can use the following workaround:

https://github.com/tiiiecherle/osx_install_config/blob/master/05_homebrew_and_casks/5b_homebrew_cask/6_mas_appstore.sh

In lines 162-201 it uses Apple Script to open the Mac App Store GUI application, and automatizes entering the Apple ID credentials. Essentially this makes it possible to sign in using the command line, in scripts and similar.