Results 1 to 3 of 3

Thread: login as a domain user on http

  1. #1
    Join Date
    Jun 2008
    Posts
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default login as a domain user on http

    Hello,

    I'm trying to read from http server using QNetworkAccessManager. This server requires logging in as a domain user. I tried using http://domain\user:password@remote.host/path/file.html

    I get a 401 reply (authentication error).

    Using the same method for ftp connection does work!

    I tried QHttp and even QtWebkit - same response.

    Any ideas?
    Last edited by orgads; 17th August 2009 at 13:17. Reason: reformatted to look better

  2. #2
    Join Date
    Dec 2007
    Posts
    628
    Thanks
    3
    Thanked 89 Times in 87 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: login as a domain user on http

    This seems to be a standard http authentication.
    You have to do something like this:

    Qt Code:
    1. QString credentials = m_userName + ":" + m_password;
    2. credentials = credentials.toUtf8().toBase64();
    3. credentials = "Basic " + credentials;
    4. header.setValue("Authorization",credentials);
    To copy to clipboard, switch view to plain text mode 
    Please notice toBase64.

  3. #3
    Join Date
    Jun 2008
    Posts
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: login as a domain user on http

    Quote Originally Posted by yogeshgokul View Post
    This seems to be a standard http authentication.
    You have to do something like this:

    Qt Code:
    1. QString credentials = m_userName + ":" + m_password;
    2. credentials = credentials.toUtf8().toBase64();
    3. credentials = "Basic " + credentials;
    4. header.setValue("Authorization",credentials);
    To copy to clipboard, switch view to plain text mode 
    Please notice toBase64.
    The server doesn't support Basic authentication. It supports NTLM and Negotiate.

    I traced it with WireShark, and Qt IS using NTLM, but it doesn't work... The negotiation seems quite similar to Firefox (of course, different challenge results in different response), which does work!

    Any ideas?

Similar Threads

  1. Logging Qt User Actions
    By Frank J. Lhota in forum Qt Programming
    Replies: 14
    Last Post: 30th May 2014, 22:36
  2. HTTP GET authentication does not proceed
    By SailingDreams in forum Qt Programming
    Replies: 2
    Last Post: 1st June 2009, 02:27

Tags for this Thread

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.