Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QML HERE map invalid here.token



  • Hi all,

    I'm having some problems trying to use the HERE map plugin in QML. I'm using windows 10 and Qt 5.15.2 MinGw 64 bit, but I will deploy the app also on android and ios. What I'm trying to do is to show the HERE map on the screen and then plot some polyline on it, but right now I'm struggling trying to autenticate.

    I'm using the minimal_map example modified to add the here.app_id and here.token parameter.

    main.qml

    import QtQuick 2.15
    import QtQuick.Window 2.15
    import QtLocation 5.6
    import QtPositioning 5.6
    
    Window {
        width: Qt.platform.os == "android" ? Screen.width : 512
        height: Qt.platform.os == "android" ? Screen.height : 512
        visible: true
    
        Plugin {
            id: mapPlugin
            name: "here" // "mapboxgl", "esri", ...
            // specify plugin parameters if necessary
            parameters: [
             PluginParameter {
                 name: "here.app_id"
                 value: "xxxxx"
             },
             PluginParameter {
                 name: "here.token"
                 value: "yyyyyy"
             }]
        }
    
        Map {
            anchors.fill: parent
            plugin: mapPlugin
            center: QtPositioning.coordinate(59.91, 10.75) // Oslo
            zoomLevel: 14
        }
    }
    

    the problem is that when I run the app the output is the following:

    Invalid here.token
    3 ,  "Qt Location requires app_id and token parameters.\nPlease register at https://developer.here.com/ to get your personal application credentials."
    

    To get the token I've done the following:

    1. I registered myself at developer.here site with a Freemium plan and I created a project.
    2. I created a REST API and an OAuth 2.0 (JSON Web Tokens) as follows (I saved the credentials.properties files that I used in the 3. step):
      1.PNG
    3. I download Postman, I created an account and I followed the instruction from the answer to this question.
      I received response in a json format like this:
      3.png a
    4. I went in my minimal_map example and I set as app_id (instead of "xxxxx") the APP ID value displayed inside the first image I posted and as here.token (instead of the "yyyyyy") the acces_token received in the JSON response from POSTMAN.
    5. I tried to clean the project, delete the build folder but nothing changed, the answer is always:
    Invalid here.token
    3 ,  "Qt Location requires app_id and token parameters.\nPlease register at https://developer.here.com/ to get your personal application credentials."
    

    What am I doing wrong? Is there something I am missing?

    If anyone has hints, suggestions or questions please tell me.
    Thanks in advace!



  • Hi all,

    After a lot of tries and some big help from this post I managed to authenticate to the HERE services using the qml HERE Map Plugin.

    To do this I had to create HERE SDK FOR ANDROID as explained in the answer to my previous link. In fact, it looks like Qt uses HERE SDK FOR IOs or HERE SDK FOR ANDROID to authenticate. But AFAIK, there is no documentation on this. Can somebody please tell me if that's the right way to access to HERE Services using Qt? Moreover, if I have to access HERE Services from Windows or MacOs I found out that using HERE SDK FOR ANDROID works, but is it the right way to access? It sounds like it is not, but I'm really confused. I really found almost no doc on this, a part from this link.

    Can somebody help?
    Thanks in advance.


Log in to reply