For a project of mine I want to sign into the Mac App Store with my Apple ID using the Terminal. I'm currently using Mojave so I cannot use inbuilt sign in functions for libraries like mas
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:
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.