(executive summary: I'm looking for working samples of how to (oauth2-)authenticate 10.2.3-OnlineRouteTask to work with
online routing services; additionally what the correct URLs of those are.)
Actually, the oauth2 part is the only thing not causing me problems..?
It's the issue of how to pass that info on to ESRI/OnlineRouteTask in a way that works?
I can correctly get an access_token from https://www.arcgis.com/sharing/rest/oauth2/token/
with QNetworkRequest.
But I don't know how to instantiate ER::OnlineRouteTask with this info?
(note: my code succeeds in getting an online route, if I use
the public sampleserver6.arcgisonline.com service without authentication.)
OnlineRouteTask accepts an ER::UserCredentials argument,
but UC requires a 'referer', which I don't know what is?
The docs for 'UserCredentials' are quite unclear,
but suggest it would contact the oauth server itself? (ie so I can't init it with data I've procured?)
(I also don't know, if it's for oauth1.0 or oauth2.0?)
The only 'docs' I've found are https: //developers.arcgis.com/qt/cpp/api-reference/class_esri_runtime_qt_1_1_user_credentials.html
The whole thing is worsened by, that none of it gives proper error messages;
instead, the 3 kinds of "responses" I get from ArcGisRuntime are
(1) whole map square turns blue? (this seems to happen if you attempt to configure
a RouteTask wrongly?)
(2) "routetask.solve" is started silently, but nothing every returns, neither success nor failure.
(3) some spurious stack trace crash in some "validateLicenseEsriforEmail??".
Also, I can't figure out which URL to actually use for online routing?
The ones I suspect to be correct, reply with "directory listing has been disabled for this item"
if I try to access them from a browser?
e.g. http: //route.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World
(I'm using 10.2.3, because porting to 10.2.6 require more changes to our code base
than we have time for in our app release timeframe, e.g. 'graphicIds' changed from sync to async.
I have already ported our code to 10.2.6 (in a separate branch), which taught me
that it will take us a long time to fully port to 10.2.6 (ie where all features are working again.)
My outset is the ArcGIS Runtime-SDK-for-Qt samples,
specifically the "Routing(Online)" sample.
However, it makes no hint at how to authenticate,
and it uses demo server
http: //sampleserver6.arcgisonline.com/arcgis/rest/services/NetworkAnalysis/SanDiego/NAServer/Route
(also, I see the same example in 10.2.6 demos?)
Some URL's I've found are
http: //logistics.arcgis.com/arcgis/rest/services/World/Route/GPServer/FindRoutes
(but can this be used for Qt, or this intended for other sdk's? How does one find this out?)
This is the one I suspect is the right one to use:
http://route.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World
but probably it should be https' -
https://route.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World
However, if I try it, I don't get any errors.. I just never get any response from '.solve()' :-(.
Currently, my code looks like this:
QString token, ref;
token = EgisProj2::access_token;
ref = "https://www.arcgis.com/sharing/rest/oauth2/token/";
ER::UserCredentials creds;
creds.setUserToken(token, ref);
m_routingTask = ER::OnlineRouteTask(actualURL, creds);
which, when used with "https://route.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World",
yields.. nada.. no error msg, no reply.
I'm finding I'm almost spending more time trying to resolve the authentication aspects of the app,
than I'm spending doing business logic app development with ESRI for my companies' actual domain
- not exactly what I was hoping for in a productivity library :-(.
What puzzles me the most, is that I get no hits when googling any of this
- it feels as if I'm the last man on earth still using Qt. Which I don't quite understand,
because it's a wonderful library.