I`m playing around with the App Studio using the provided samples, mostly trying to combine the functionality. I managed to add a secured FeatureService using the GitHub Wiki (Access Secured ArcGIS Layers in your App using Runtime · Esri/arcgis-appstudio-samples Wiki · GitHub). But I don`t want to hardcode my credentials into the app, which should be used by different users in the end. I also tried the OAuth Method which also worked, but I would have to login every time I start the app.
So my question is: Is it possible to pass the credentials/token that are used by the AppStudio Player to the apps in order to load secured layers without having to login every time?
Thanks for every hint.
You can take a look at the sample "Portal User Info" sample, arcgis-appstudio-samples/Portal User Info(4.2) at v4.2 · Esri/arcgis-appstudio-samples · GitHub , and then replace this MyApp.qml code attached to the sample for the additional functionality to check on Player credential information (if it is running inside the Player) and then creating the Runtime Portal object for the app. Take a look at the Component.inCompleted section.
Nearly 3 years later just want to say thank you for this. I was able to adapt your solution to work with our enterprise portal such that when the app is 'contained' in AppStudio Player the portal (and credentials) the user is signed into in AppStudio Player can be used in the app. Otherwise if not in AppStudio Player user is prompted for log in. Thank You ! :collision: