Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QtWebEngine
  4. Open login page of QOAuthAuthorizationCodeFlow with QWebEngineView
Forum Updated to NodeBB v4.3 + New Features

Open login page of QOAuthAuthorizationCodeFlow with QWebEngineView

Scheduled Pinned Locked Moved Unsolved QtWebEngine
2 Posts 2 Posters 731 Views 1 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
    Rjuz
    wrote on last edited by
    #1

    Hi together,

    i'm trying to solve following problem.

    Description:

    I'm using the QOAuthAuthorizationCodeFlow to authenticate against a Service. For that a i have an instance oauth_ of the class QOAuthAuthorizationCodeFlow. Ok, then i'm setting all relevant attributes with member variables like:

    oauth_->set_scope(scope_);
    oauth_->setClientIdentifier(client_identifier_);
    oauth_->setAuthorizationUrl(auth_url_);
    // and so on ...
    

    Then i'm configuring several connects with signals and slots which handle the requests and responses. Everything works fine.
    Now the relevant point. Up to now i used an external browser (firefox) to authenticate against the service. Here the code

    connect(oauth_, &QOAuthAuthorizationCodeFlow::authorizeWithBrowser, &QDesktopServices::opernUrl);
    oauth_->grant();
    

    The grant() function starts the OAuth 2 procedure.

    But i don't want to use the external browser. I have to use the QWebEngineView for authentication. I found this code snippet to open a page:

    QWebEngineView *view_ = new QWebEngineView;
    view_->setUrl(QUrl("https://forum.qt.io"));
    view_->load();
    

    This also works.

    How can i connect the QWebEngineView with my QOAuthAuthorizationCodeFlow ?
    Anyone some ideas ?

    Thanks in advance
    Rjuz

    1 Reply Last reply
    0
    • J Offline
      J Offline
      Jonas12345
      wrote on last edited by Jonas12345
      #2

      This is a great question and I'm dealing with the same issue, did you manage to figure out the solution? It would be great to share with the rest of us in case you managed to solve this issue...

      If not, this is what I'm going to try out tomorrow:

      1. The AuthorizeWithBrowser signal has a URL as parameter:
        https://doc.qt.io/qt-5/qabstractoauth.html#authorizeWithBrowser
      2. I will create a public slot method where I create the web engine and open the page
      3. I will inject JavaScript code to automatically fill out the login form

      I will keep you posted!

      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