Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt WebKit
  4. How to provide Username and password while using QWebEngineView
Forum Updated to NodeBB v4.3 + New Features

How to provide Username and password while using QWebEngineView

Scheduled Pinned Locked Moved Unsolved Qt WebKit
2 Posts 2 Posters 905 Views 2 Watching
  • 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.
  • R Offline
    R Offline
    Ryna
    wrote on 10 Jul 2021, 01:10 last edited by Ryna 7 Oct 2021, 01:22
    #1

    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 :)

    P 1 Reply Last reply 11 Jul 2021, 23:09
    0
    • R Ryna
      10 Jul 2021, 01:10

      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 :)

      P Offline
      P Offline
      Pablo J. Rogina
      wrote on 11 Jul 2021, 23:09 last edited by
      #2

      @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

      Upvote the answer(s) that helped you solve the issue
      Use "Topic Tools" button to mark your post as Solved
      Add screenshots via postimage.org
      Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      1

      1/2

      10 Jul 2021, 01:10

      • Login

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