Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. JWT authenication in qml
Forum Updated to NodeBB v4.3 + New Features

JWT authenication in qml

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 294 Views
  • 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 Offline
    D Offline
    dsba
    wrote on last edited by
    #1

    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
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved