Results 1 to 4 of 4

Thread: Url request problem for https: Host requires authentication

  1. #1
    Join Date
    Dec 2014
    Posts
    82
    Thanks
    10
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Url request problem for https: Host requires authentication

    Hi,

    I'm using Qt 4.8.5. I was making a request to an url which gaves me back a json reply. It was all ok until I had to change the url from http:// to https:// (Note the security 's' )

    Qt Code:
    1. text = "https://myweb.com/api/mylist?PARAM1=00000000&PARAM2=1111111111&PARAM3=2222222";
    2. _Url = text;
    3.  
    4. QNetworkRequest request(_Url);
    5. QNetworkReply *myReply = nam->get(request);
    To copy to clipboard, switch view to plain text mode 

    Now if you do a reply->ErrorString() you get: "Host requires authentication"

    How can I fix that problem? Any example or idea?

    Thanks a lot!

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Url request problem for https: Host requires authentication

    Have you tried connecting to the network manager's authenticationRequired() signal?

    Cheers,
    _

  3. #3
    Join Date
    Dec 2014
    Posts
    82
    Thanks
    10
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Url request problem for https: Host requires authentication

    Hi anda_skoa, I tried with:

    Qt Code:
    1. m_ftpManagerPtr = new QNetworkAccessManager(this);
    2. connect ( m_ftpManagerPtr, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)), this, SLOT(onAuthenticationRequestSlot(QNetworkReply*,QAuthenticator*)) );
    3.  
    4. void Test::onAuthenticationRequestSlot(QNetworkReply *aReply, QAuthenticator *aAuthenticator)
    5. {
    6. aAuthenticator->setUser(m_ftpUser);
    7. aAuthenticator->setPassword(m_ftpPasswd);
    8. }
    To copy to clipboard, switch view to plain text mode 

    But it don't gets into the slot, do you know why? do I have to initialize something before?

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Url request problem for https: Host requires authentication

    Hmm.
    Did the connect succeed? I.e. is its return value "true"?

    Cheers,
    _

Similar Threads

  1. website requires authentication
    By prajith in forum Newbie
    Replies: 4
    Last Post: 5th May 2014, 07:22
  2. HTTPS request returns damaged HTML body
    By ljuhrich in forum Qt Programming
    Replies: 6
    Last Post: 2nd June 2013, 08:37
  3. Replies: 0
    Last Post: 3rd May 2011, 09:15
  4. HTTPS Client Authentication (Mutual Authentication)
    By cbourne in forum Qt Programming
    Replies: 3
    Last Post: 5th December 2010, 11:51
  5. Https POST Request
    By munna in forum Qt Programming
    Replies: 10
    Last Post: 11th November 2006, 14:24

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.