Problem is calling cloud print search api
I am trying to call cloud print search api form my desktop application.
Below is my working code so far.
QString httpRequest; httpRequest = "https://www.google.com/cloudprint/search"; QEventLoop loop; QNetworkAccessManager mNetworkManager; QObject::connect(&mNetworkManager, SIGNAL(finished(QNetworkReply *)), &loop, SLOT(quit())); QNetworkRequest request; request.setUrl(QUrl(httpRequest)); request.setRawHeader("Authorization" ,accessToken.toUtf8()); request.setRawHeader("Content-Type" ,"application/json"); request.setRawHeader("Host" ,"www.google.com"); QNetworkReply *rep = mNetworkManager.get(request); QObject::connect(&mNetworkManager, SIGNAL(finished(QNetworkReply *)), this, SLOT(Onfinish(QNetworkReply *))); loop.exec();
I am getting error ContentOperationNotPermittedError.
I know its issue related to access but what is wrong with the above implementation i am not getting that. I am generating access token using aouth 2.0 . I have also tested above api using google playground successfully.
ContentOperationNotPermittedError = HTTP error 403 = Access Denied
How do you create the OAuth tokens? Make sure you create them with the same network access manager you use to send your requests. Or at least make sure you transfer them from the other QNAM.
Please see below link for the code file now i am using single object to retrieve access token and to call search api.
I am getting same error.