Url request problem for https: Host requires authentication
Hi,
I'm using Qt 4.8.5. I was making a request to an url which gaves me back a json reply. It was all ok until I had to change the url from http:// to https:// (Note the security 's' )
Code:
text = "https://myweb.com/api/mylist?PARAM1=00000000&PARAM2=1111111111&PARAM3=2222222";
_Url = text;
QNetworkRequest request(_Url);
QNetworkReply *myReply = nam->get(request);
Now if you do a reply->ErrorString() you get: "Host requires authentication"
How can I fix that problem? Any example or idea?
Thanks a lot!
Re: Url request problem for https: Host requires authentication
Have you tried connecting to the network manager's authenticationRequired() signal?
Cheers,
_
Re: Url request problem for https: Host requires authentication
Hi anda_skoa, I tried with:
Code:
m_ftpManagerPtr = new QNetworkAccessManager(this);
connect ( m_ftpManagerPtr, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)), this, SLOT(onAuthenticationRequestSlot(QNetworkReply*,QAuthenticator*)) );
void Test::onAuthenticationRequestSlot(QNetworkReply *aReply, QAuthenticator *aAuthenticator)
{
aAuthenticator->setUser(m_ftpUser);
aAuthenticator->setPassword(m_ftpPasswd);
}
But it don't gets into the slot, do you know why? do I have to initialize something before?
Re: Url request problem for https: Host requires authentication
Hmm.
Did the connect succeed? I.e. is its return value "true"?
Cheers,
_