Headless burp authenticated scans
How can I perform an authenticated scan using headless burp?
There is also a how-to guide on the support site.
However, this would mean you will require to run burp in a non headless mode. I.e with a GUI and record the macro.
What type of authentication do you want to perform? If it’s basic auth then this can be done natively with Burp Scanner through the REST API however if it requires workarounds then session handling rules/macros will be the way to go.