I have username and password from portal (ArcGIS Enterprise 11.2). How can I get a LicenseInfo from that to set for ArcGISEnvironment in Kotlin Maps SDK?
Hi,
You can load an enterprise portal with your credentials and fetchLicenseInfo from the portal.
Here is the documentation on how to set license info from user authentication.
Thanks
Rama
i've try with code below
val portal = Portal(url = "https://example.com/portal", connection = Portal.Connection.Authenticated)
portal.load().getOrElse { error ->
Log.d("Err","Error loading portal: ${error.message}")
}
val licenseInfo = portal.fetchLicenseInfo().getOrElse { error ->
Log.d("Err","Error fetching licenseInfo: ${error.message}")
return
}
val licenseResult = ArcGISEnvironment.setLicense(licenseInfo)
And I see the log return
A token or API key is required., additionalMessage=A token or API key was not provided to access
https://example.com/portal/sharing/rest/portals/self., errorCode=18004
I think I missing set API key by
ArcGISEnvironment.apiKey = ApiKey.create("API key string")
And I check how to get API key string from portal (now my portal use ArcGIS Enterprise 11.2) and i see API key credentials are not supported in ArcGIS Enterprise versions prior to 11.4.
So how can I get credentials to set for my portal in application?
I see the sample and a tutorial but it's use Composable with com.arcgismaps.toolkit, now my project still use Android View with ArcGIS Kotlin SDK 200.6, not Composable, so how can i can authenticate?
We updated the authenticate with OAuth sample in 200.5.0 to use the toolkit Authenticator composable component which abstracts all the complexity. If you need to use it for view based sample, you can reference the 200.4.0 version of the same sample that is available here. More details on the custom authentication handlers is provided here
Rama