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

How to provide Username and password while using QWebEngineView



  • Hi All,
    I am opening a web page using QWebEnginePage and have to login to enter into it.

    class projWebPage : public QWebEnginePage
    {
        Q_OBJECT
        public:
            explicit projWebPage(QWidget *parent = nullptr);
    };
    

    In Class projWebView constructor, I have following changes

    auto projView = new QWebEngineView(this);
    projWebPage *page = new projWebPage(this);
    projView->setPage(page);
    layout()->addWidget(projView);
    QString httpUrl = "http://172.10.4.1";
    page->load(QUrl(httpUrl));
    

    This httpUrl, open a page to enter username and password. I want to bypass that and open the next page by passing username and password along with url. I tried http://username:password@172.10.4.1 but didn't work.

    Also I had tried using

     QUrl httpUrl = "http://172.10.4.1";
     httpUrl.setUserName("username");
     httpUrl.setPassword("password");
     page->load(httpUrl);
    

    But no luck..

    Is there a way to send user name and password along?
    Thanks :)



  • @Ryna said in How to provide Username and password while using QWebEngineView:

    http://172.10.4.1

    Look at the HTML source code of that page and find how the username/password are sent to the web server once the user is done with entering such values


Log in to reply