How do I bring ArcGIS Runtime into Survey123 for named user licensing?

90
1
01-18-2019 10:40 AM
Highlighted
New Contributor III

Hi AppStudio Team!

I need to bring ArcGIS Runtime into Survey123 so I can sync feature services. I saw Erwin answered a similar question previously, but my situation is slightly different, so I thought it would be best to create a new thread.

I asked about this over on the Survey123 forum. James Suggested we look at using parallel portal objects. We tried creating a parallel Portal object and we were able to get sync working (yeah!), the only problem is we have to sign in twice - once for the Survey123 portal object and once for the runtime object. 

Below is the code we are currently using. We will always be signed into Survey123 and have an Esri user access token when we run sync. Is it possible to create a new portal object using an access token instead of a username and password? 

var portal = ArcGISRuntimeEnvironment.createObject("Portal", {url: "https://www.arcgis.com"});
var credential = ArcGISRuntimeEnvironment.createObject("Credential");
credential.username = "[portal username]";
credential.password = "[portal password]";
portal.credential = credential;
portal.loadStatusChanged.connect(function(){
if (portal.loadStatus === Enums.LoadStatusLoaded) {
  var info = portal.portalInfo;
  var licenseInfo = info.licenseInfo;
  // update licence Info
  ArcGISRuntimeEnvironment.setLicense(licenseInfo);
  console.log("licensceLevel after Update:"+ArcGISRuntimeEnvironment.license.licenseLevel);
}‍‍‍‍‍‍‍‍‍‍‍‍‍

Thanks!

Matt

Reply
0 Kudos
1 Reply
Highlighted
Esri Regular Contributor

Hello Matt, 

From the ArcGIS Runtime SDK for Qt‌ QML documentation link on Credentials object, Credential QML Type | ArcGIS for Developers , it can be composed of user account information (username and password), OAuth client information (OAuthClientInfo), or a secured token.

On the side note, would you be able to create both Survey123 Portal object and ArcGIS Runtime object(s) together when the user first logins? 

Thank you,

Erwin 

Reply
0 Kudos