Dears community,
I have a task to get a Runtime (UWP) license with authorization by logging into the portal to get license Standard or higher from user.
and I noticed that the old version of ArcGIS Runtime UWP 100... does not work in the new edition of version 200.6.0
Old version 100, it works
CredentialRequestInfo loginInfo = new CredentialRequestInfo();
loginInfo.ServiceUri = new Uri("https://arcgis.com/sharing/rest");
try
{
var cred = await AuthenticationManager.Current.GenerateCredentialAsync(
new Uri("https://arcgis.com/sharing/rest"),
"user",
"password") as ArcGISTokenCredential;
// Connect to the portal (ArcGIS Online or ArcGIS Portal) using the credential
ArcGISPortal arcgisPortal = await ArcGISPortal.CreateAsync(loginInfo.ServiceUri, cred);
// Get LicenseInfo from the portal
LicenseInfo licenseInfo = await arcgisPortal.GetLicenseInfoAsync();
ArcGISRuntimeEnvironment.SetLicense(licenseInfo);
But it doesn't work in 200 version ArcGIS Runtime UWP, unfortunately I couldn't get the code to work on the new version of the platform. I'm starting to think about using the old version 100 for work.
I'll be glad to get answers on where to go and what to look for.
Thank you for your support.
Best regards, Azamat
Solved! Go to Solution.
The overload of CreateAsync that takes a specific credential has indeed been deprecated and removed. In general, instead of passing/setting a specific Credential on your portal or layer, you should just add it to the AuthenticationManager. Here is how you can accomplish your portal login in 200.x:
var cred = await AccessTokenCredential.CreateAsync(
new Uri("https://arcgis.com/sharing/rest"),
"user",
"password");
AuthenticationManager.Current.AddCredential(cred);
ArcGISPortal arcgisPortal = await ArcGISPortal.CreateAsync(cred.ServerContext, loginRequired: true);
// the rest is unchanged
This should continue to work. Can you clarify what you mean by "doesn't work" ?
I mean that the project does not compile. Please look at the screenshot of the code with the warning that prevents compilation:
I tried to change it but it didn't work 😞
Thank you.
Best regards, Azamat
The overload of CreateAsync that takes a specific credential has indeed been deprecated and removed. In general, instead of passing/setting a specific Credential on your portal or layer, you should just add it to the AuthenticationManager. Here is how you can accomplish your portal login in 200.x:
var cred = await AccessTokenCredential.CreateAsync(
new Uri("https://arcgis.com/sharing/rest"),
"user",
"password");
AuthenticationManager.Current.AddCredential(cred);
ArcGISPortal arcgisPortal = await ArcGISPortal.CreateAsync(cred.ServerContext, loginRequired: true);
// the rest is unchanged