Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Login Page is not rendered using qt application
Forum Updated to NodeBB v4.3 + New Features

Login Page is not rendered using qt application

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 254 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.
  • B Offline
    B Offline
    Bhargavi
    wrote on last edited by
    #1

    we are using qt 5.11.2 to develop our windows desktop application. In order to show the login Page which has OAuth2.0 authentication which is in cloud we are sending request with client_id, response_type,code_challenge,code_challenge_method & redirect uri as parameters but the Page is not rendering properly all the css files rendering gave error. Could you please suggest is there any changes have to made in code

    Below is the Sample Code which used in our application
    LoginPage::LoginPage(QWidget *parent)
    : QWebView(parent),
    {
    }
    void LoginPage::createUI()
    {

    createNetworkAccessManager();
    
    page()->setForwardUnsupportedContent(true);
    this->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);
    
    this->page()->settings()->setFontFamily(QWebSettings::StandardFont, "Medium");
    this->page()->settings()->globalSettings()->setFontFamily(QWebSettings::StandardFont, " Medium");
    
    this->setContextMenuPolicy(Qt::NoContextMenu);
    
    connect(this,
            SIGNAL(loadFinished(bool)),
            this,
            SLOT(slotPageLoadFinished(bool)));
    
    connect(this,
            SIGNAL(linkClicked(const QUrl&)),
            this,
            SLOT(slotOpenExternalURL(const QUrl&)));
    
    connect(this->page(),
            SIGNAL(unsupportedContent(QNetworkReply*)),
            this,
            SLOT(slotContentUnsupported(QNetworkReply*)));
    

    }

    void LoginPage::createNetworkAccessManager()
    {

    m_networkAccessManager.clearAccessCache();
    QNetworkConfiguration networkConfig = QNetworkConfigurationManager().defaultConfiguration();
    networkConfig.setConnectTimeout(300000);
    m_networkAccessManager.setConfiguration(networkConfig);
    
    // These slots are used to make some on-loading and post-loading processes
    connect(&m_networkAccessManager,
            SIGNAL(sslErrors(QNetworkReply*, const QList<QSslError>&)),
            this,
            SLOT(slotSslErrors(QNetworkReply*, const QList<QSslError>&)));
    
    connect(&m_networkAccessManager,
            SIGNAL(finished(QNetworkReply*)),
            this,
            SLOT(slotNAMLoadFinished(QNetworkReply*)));
    
    this->page()->setNetworkAccessManager(&m_networkAccessManager);
    

    }

    void LoginPage::startLoginRequest()
    {

    QString szUrl = QString(szURLString);
    QUrl url(szUrl);
    QUrlQuery tmpQuery(url);
    tmpQuery.addQueryItem("client_id", clientIdValue);
    tmpQuery.addQueryItem("response_type", "code");
    
    //add code verifier also
    tmpQuery.addQueryItem("scope", "profile email");
    
    //CODE_DM_4150_001
    QString szCodeChallenge = QCryptographicHash::hash(m_szcodeVerifier.toLocal8Bit(), QCryptographicHash::Sha256).toBase64(QByteArray::OmitTrailingEquals|QByteArray::Base64UrlEncoding);
    
    tmpQuery.addQueryItem("code_challenge", szCodeChallenge);
    
    tmpQuery.addQueryItem("code_challenge_method", "S256");
    
    
    if(!RedirectUrl.isEmpty())
        tmpQuery.addQueryItem("redirect_uri",RedirectUrl);
    
    url.setQuery(tmpQuery);
    
    sendRequest(url);
    

    }

    void LoginPage::sendRequest(QUrl url, bool bIsAuthorizationHeaderReq)
    {

    QNetworkRequest webrequest(url);
    QSslConfiguration sslConfiguration = QSslConfiguration::defaultConfiguration();
    sslConfiguration.setProtocol(QSsl::AnyProtocol);
    webrequest.setSslConfiguration(sslConfiguration);
    if (bIsAuthorizationHeaderReq)
    {
        webrequest.setRawHeader("Authorization", m_szAuthorizationHeader.toLatin1());
    }
    webrequest.setHeader(QNetworkRequest::ContentTypeHeader,
                         QString("application/x-www-form-urlencoded"));
    
    load(webrequest,QNetworkAccessManager::PostOperation);
    

    }

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mchinand
      wrote on last edited by
      #2

      @Bhargavi said in Login Page is not rendered using qt application:

      all the css files rendering gave error

      What are the errors you are getting? Post the actual errors.

      1 Reply Last reply
      0
      • B Offline
        B Offline
        Bhargavi
        wrote on last edited by
        #3

        Received Error Code as 5 and Error String from QNetworkReply :as QNetworkReply::OperationCanceledError (the operation was canceled via calls to abort() or close() before it was finished).

        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