No we don't provide that kind of configuration as it's not safe to have the password not encrypted in the application.The proper way to do it is to use a proxy that will know the credentials and log-in the user on the server. This require you to have a IIS/PHP/JEE server and may slow down a bit your application as all traffic will use the proxy.Here is some thread from the JS API forum that you may find useful Login to ArcGIS Server Secured Services, Programmatically Log In to ArcGIS Online via Javascript Application, Possible to hard code credentials?.