Here's an interesting edge case that I'd like to put out there in case anyone can help....
Lets say I have a secure feature service published by an arcgis server (for arguments sake let's say it's 10.4.1 if that matters).
I add that feature service as a stored item in AGOL with saved credentials. I can now add that item to web maps etc, so long as I'm logged into AGOL.
When you add a feature service to AGOL like this, it creates a proxy url, so to speak, that redirects to the actual underlying feature service url.
Now, let's say I'm using AppStudio to interact with that item/feature service. I log into AGOL using the 'Portal' object. I then try to do a 'fetch feature service info' using a 'ServiceInfoTask', using the proxy url as the ServiceInfoTask url. This fails because it doesn't have a valid token or authorization.
The proxy url it creates begins with "https://utility.arcgis.com/usrsvcs/servers/....etc". I tried adding that url to the identity manager using the portal credential object but that didn't work. Obviously I can't hit the source url of the actual portal feature service as the credential for that is stored in AGOL.
Any ideas how I might access the underlying feature service, via the AGOL stored item?
Cheers,
-Paul