Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Developer
esam_tec
Posts: 85
Registered: ‎06-22-2013
My Device: N/A

Problem with OAuth web service..Help

		QUrl serviceUrl = QUrl("http://example.com/requestToken");
		QNetworkAccessManager *networkManager = new QNetworkAccessManager(this);
		QNetworkRequest request(serviceUrl);
		request.setHeader(QNetworkRequest::ContentTypeHeader,"application/x-www-form-urlencoded");

		QByteArray data;
		QUrl params;
		params.addQueryItem("oauth_consumer_key", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
		params.addQueryItem("oauth_nonce", "xxxxxxxxxxxxxxxxxxx");
		params.addQueryItem("oauth_timestamp", "1382472598");
		params.addQueryItem("oauth_signature_method", "PLAINTEXT");
		params.addQueryItem("oauth_signature", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
		data.append(params.toString());
		data.remove(0, 1);
		QNetworkReply *reply = networkManager->post(request,data);

		////////////////////////////////////////////////////////

 I have tried this code, but the reply always gives (Error and the code is 401  And the Error string is :: Host requires authentication)

Please what is wrong with this code, 

Thanks in advance,

Regular Contributor
coolneo
Posts: 56
Registered: ‎06-25-2012
My Device: non-blackberry user

Re: Problem with OAuth web service..Help

hi ,

 

writing oauth client is not an easy task i will reccomend you to use kqoauth , which is an excellent library you can use to perform Oauth in Qt applications !!

Developer
esam_tec
Posts: 85
Registered: ‎06-22-2013
My Device: N/A

Re: Problem with OAuth web service..Help

How to install this package on Windows?
Regular Contributor
coolneo
Posts: 56
Registered: ‎06-25-2012
My Device: non-blackberry user

Re: Problem with OAuth web service..Help

i think you can directly include the source code itself and use it not need to build binaries.

Check http://www.johanpaul.com/blog/2010/10/introducing-kqoauth-easy-and-powerful-oauth-library-for-qt/