Support for adding API key to QML directly (rather than in the c++ code)

452
1
02-17-2022 08:11 AM
by Anonymous User
Not applicable

Using AppStudio to create an app, it is not always possible or desirable for developers to access the c++ code in order to add the api key. 

Will support be added to add the api key directly within the QML? If it is a security issue, that doesn't quite make sense as the same api key is totally visible in most javascript based client applications.

0 Kudos
1 Reply
JamesBallard1
Esri Regular Contributor

Hi @Anonymous User. I can answer this from an ArcGIS Runtime perspective.

We do actually support and encourage setting the license in C++ code. Code like this will work, and this is the boilerplate example code we provide in our QML template:

QCoreApplication::instance()->setProperty("Esri.ArcGISRuntime.license", "YourLicenseStringHere");

The Runtime will internally check for that property (with that exact name) at startup and set the license string.

As you guessed, it can be a security concern to have your API key in Qml code directly, as some app configurations ship qml files in plaintext, so that leaves the key unprotected.

Unfortunately, I cannot answer about AppStudio specifics. I recommend posting your question in https://community.esri.com/t5/arcgis-appstudio-questions/bd-p/arcgis-appstudio-questions so the AppStudio experts can help you.