Login Page is not rendered using qt application
-
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);
}