0

Error - Authorization Required : https://social.yahooapis.com/v1/user/OAuthYahooGUID/contacts

Hi,

I got access token from yahoo API but Getting error for User Contacts API. Here is my code..... Please help me where I am wrong :


1st method I tried : var params = { // Authorization: "OAuth", format: "json", realm: "yahooapis.com", oauth_consumer_key: $scope.yahooApp.oauth_consumer_key, oauth_nonce: oauthYahoo.getNonce(), oauth_signature_method: "HMAC-SHA1", oauth_timestamp: oauthYahoo.getTimeStamp(), oauth_version: "1.0", // oauth_signature: decodeURIComponent(dataObj.oauth_token_secret), // oauth_signature: decodeURIComponent(dataObj.oauth_token_secret)+'%3D', // oauth_signature: decodeURIComponent(dataObj.oauth_token_secret+'%26'), // oauth_signature: decodeURIComponent(reqToken.oauth_token_secret), // oauth_signature: decodeURIComponent($scope.yahooApp.oauth_signature+'%26'), // oauth_signature: dataObj.oauth_session_handle, // oauth_<signature:decodeURIComponent>($scope.yahooApp.oauth_signature + '%26' + dataObj.oauth_token_secret), oauth_signature: $scope.yahooApp.oauth_signature + "&" + reqToken.oauth_token_secret, oauth_token: dataObj.oauth_token, oauth_session_handle: dataObj.oauth_session_handle } // $http.defaults.headers.common.Authorization=oauth.toHeader(oAuth).Authorization;//'oAuth '+ JSON.stringify(oAuth); //.toString(); $http({method: 'POST', url: "<http://social.yahooapis.com/v1/user/>" + dataObj.xoauth_yahoo_guid + "/contacts", params: params }).success(function (data, status, headers, config) { var dataObj = $scope.yahooResponseToObj(data); }); 2nd Method I tried : var request_data = { url: '<https://social.yahooapis.com/v1/user/>' + dataObj.xoauth_yahoo_guid + '/contacts', method: 'POST', data: { Authorization: "OAuth", format: "json", realm: 'yahooapis.com', oauth_consumer_key: $scope.yahooApp.oauth_consumer_key, oauth_signature: $scope.yahooApp.oauth_signature + "&" + reqToken.oauth_token_secret, oauth_token: dataObj.oauth_token } }; var auth = oauthYahoo.toHeader(oauthYahoo.authorize(request_data)), header = auth.Authorization; $http.defaults.headers.common.Authorization = decodeURIComponent(header); $http({method: 'POST', url: "<https://social.yahooapis.com/v1/user/>" + dataObj.xoauth_yahoo_guid + "/contacts" }).success(function (data, status, headers, config) { var dataObj = $scope.yahooResponseToObj(data); });

Both not working kindly HELP.

by
0 Replies

Recent Posts

in Contacts