Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    Unsolved JWT authenication in qml

    QML and Qt Quick
    1
    1
    137
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • D
      dsba last edited by

      Hi,
      I am very much new to REST API, I tried Flickr Calls example that 's was given in book Qt5 Cadaques.
      I faced two problems,

      1. I could assign json object to listView model but this did not work
        for example:
      In javascript function I am writing as
      if(xhr.readyState === XMLHttpRequest.DONE)
            json = JSON.parse(xhr.responseText.toString())
            for(var i=0; i<json.length; i++) {
                view.model = json[i].id
            }
      }
      
      In ListView's Delegate:
      delegate: Image {                      
                   source: "/home/images/test_" + modelData.id + ".png
      }
      
      1. I have user name : "admin" and password: "123" receiving from end points
        I have created two textInput for user to enter his user name and password
        and writing javascript function called request
      function request() {
              var xhr = new XMLHttpRequest();
              if(xhr.readyState === XMLHttpRequest.DONE) {
                 var json = JSON.parse(xhr.responseText.toString())
      }
             xhr.open("POST", url, true, "admin", "123") 
             xhr.send("userName=user&password=pwd");  /*sending entered text from textInput to http*/
      }
      

      This does not get authenticated and moves to next screen. What and where am I doing wrong.

      Thanks in advance for the support and quick response

      1 Reply Last reply Reply Quote 0
      • First post
        Last post