1) LoginMainApp does a HTTPService connect to the rest services.
2) I am currently running mine on java.
If you're simply generating a Long-lived token to access the services, attaching it to the config.xml will work.
If you're retrieving a short-lived token on the fly to access the services, you will need to follow the steps i mentioned above. Mapmanager.mxml HAS to be modified in order for this to work. (Assuming you are using the sample flex viewer)