Say I have a secure feature service published from an on premise ArcGIS Server, that I then have added as an item to an AGOL account with stored credentials. i.e. I can sign in to AGOL, and I can now add that as a layer into a web map and do not need to enter credentials.
Now I want an app to be able to sign into AGOL and load that feature service/item (whether directly or via a web map) into a map such that I can edit it, and even generate an offline geodatabase from it.
Obviously the key here is that I want the user to log in with their AGOL account and not have to enter any credentials for the feature service, rather let AGOL handle that using the stored credentials.
Any suggestions on how I should be approaching this? Sample code in any of the templates?