You could help yourself by showing what you have done. Is replyFinished(QNetworkReply *) declared as a slot? Are any warnings issued at program start?
You could help yourself by showing what you have done. Is replyFinished(QNetworkReply *) declared as a slot? Are any warnings issued at program start?
This is what I am trying:
DownloadManager:ownloadManager()
{
QNetworkAccessManager *manager = new QNetworkAccessManager(this);
QUrl url("https://accounts.google.com/o/oauth2/token");
QNetworkRequest request(url);
request.setHeader(QNetworkRequest::ContentTypeHead er, "application/x-www-form-urlencoded");
QUrl params;
params.addQueryItem("client_id", "example.com");
params.addQueryItem("client_secret", "example_secret");
params.addQueryItem("code", "example_code");
params.addQueryItem("redirect_uri", "urn:ietf:wgauth:2.0
ob");
params.addQueryItem("grant_type", "authorization_code");
QObject::connect(manager, SIGNAL(finished(QNetworkReply *)), this, SLOT(replyfinished(QNetworkReply *)));
QNetworkReply *reply=manager->post(request, params.encodedQuery());
}
void DownloadManager::replyfinished(QNetworkReply *reply)
{
int i;
QByteArray bytes = reply->readAll(); // bytes
qDebug("reply received");
for(i=0;i<=bytes.size();i++)
qDebug() << bytes.at(i);
}
I am not getting any response from server since reply->readAll(); is not returning anything.
Can you help me out.
If else can u please tell me how to use KQOauth/QOauth to access google contacts api.
Thanks in advance
Regards
Abdul Moiz
See your other thread... the answer is probably the same. Also, a finished transfer is not necessarily a successful transfer. Have you looked at QNetworkReply::error()?
"We can't solve problems by using the same kind of thinking we used when we created them." -- Einstein
If you are posting code then please use [code] [/code] tags around it - makes addressing the problem easier.
Bookmarks