Can anyone provide me with a snippet of code that I can type the login information into so that it will log in upon launch?
Thanks for the help!
complete sample: http://esri.github.io/esri-leaflet/examples/arcgis-server-auth.html
a second, more difficult, and more production appropriate option is to utilize a server side proxy to hide the username and password in code that is NOT accessible to your end users so that the proxy can broker requests to secure resources and append a token on its own.
Open Source proxies in ASP.NET, PHP and Java that we host on GitHub
no matter what you do, you'll need to make sure you are honoring your license agreement and making sure the private content is only accessed by the number of ArcGIS Online named users you're paying for.