-1

Actually getting Contacts after jumping through all the OAuth loops

I feel like I have to be missing something simple. I've struggled painfully through all the OAuth hurdles and have finally arrived at the point where I believe I should be able to actually get my contacts. That being said, I'm missing the clear and concise documentation for how to do this. For instance, when I look here (http://developer.yahoo.com/social/rest_api_guide/contacts-resource.html) all I can see is that I'm supposed to use this url (http://social.yahooapis.com/v1/user/{guid}/contacts). But, I don't see how to incorporate any of the values I got back in my last OAuth call (which was this: http://developer.yahoo.com/oauth/guide/oau...th-accesstoken).

I have all the data that was returned to me (as described in that prior link - the oauth_token, oauth_token_secret, oauth_expires_in, oauth_session_handle, oauth_authorization_expires_in & xoauth_yahoo_guid values). I just don't see anywhere that tells me how to properly build the url for the next step, which is actually calling the Yahoo Contacts API and retrieving my contacts. I assume the {guid} placeholder in the url http://social.yahooapis.com/v1/user/{guid}/contacts should be replaced by the value of the xoauth_yahoo_guid param returned to me, but am not sure about anything else.

Thanks in advance,
BN

by
24 Replies
  • So I found this link: http://developer.yahoo.com/oauth/guide/oau...ke-request.html

    Still getting: {"error":{"lang":"en-US","description":"Please provide valid credentials. OAuth oauth_problem=\"signature_invalid\", realm=\"yahooapis.com\""}}

    I've tried it with the params in the url, I've tried it by setting the Authorization header and I've tried it by doing both. Still no luck. Any hints on what to look at next in terms of debugging this PITA?
    1
  • Trying more things... feel like I'm totally stabbing in the dark. Now I'm getting this:

    {"error":{"lang":"en-US","description":"Please provide valid credentials. OAuth oauth_problem=\"unable_to_determine_oauth_type\", realm=\"yahooapis.com\""}}

    Any thoughts or hints at all?
    0
  • QUOTE (bryan.noll @ Oct 2 2009, 12:19 PM) <{POST_SNAPBACK}>
    Trying more things... feel like I'm totally stabbing in the dark. Now I'm getting this:

    {"error":{"lang":"en-US","description":"Please provide valid credentials. OAuth oauth_problem=\"unable_to_determine_oauth_type\", realm=\"yahooapis.com\""}}

    Any thoughts or hints at all?


    I'm on the same boat as you bryan.
    It looks to me that there is a bug on yahoo's side when verifying the "Authorization" header on the request ("http://social.yahooapis.com/v1/user/" + guid+ "/contacts")

    Yahoo devs, please take a look at this issue.
    I'm trying to setup an oauth demo for yahoo on http://dyuproject.appspot.com ... this bug is the show stopper.
    You can see the output (hidden link) at http://dyuproject.appspot.com/oauth/yahoo/contacts

    Here is the code (using http://code.google.com/p/dyuproject):
    CODE
    public final class OAuthYahooService extends AbstractService
    {


    static final Consumer __consumer = Consumer.getInstance();
    static final Endpoint __yahooEndpoint = __consumer.getEndpoint("api.login.yahoo.com");

    @Override
    protected void init()
    {

    }

    @HttpResource(location="/oauth/yahoo/contacts")
    @Get
    public void service(RequestContext rc) throws IOException
    {
    HttpServletRequest request = rc.getRequest();
    HttpServletResponse response = rc.getResponse();

    Token token = __consumer.getToken(__yahooEndpoint.getConsumerKey(), request);
    switch(token.getState())
    {
    case Token.UNITIALIZED:
    String requestUrl = request.getRequestURL().toString();
    UrlEncodedParameterMap params = new UrlEncodedParameterMap()
    .add(Constants.OAUTH_CALLBACK, requestUrl);

    Response r = __consumer.fetchToken(__yahooEndpoint, params,
    TokenExchange.REQUEST_TOKEN, token);
    if(r.getStatus()==200 && token.getState()==Token.UNAUTHORIZED)
    {
    // unauthorized request token
    __consumer.saveToken(token, request, response);
    StringBuilder urlBuffer = Transport.buildAuthUrl(
    __yahooEndpoint.getAuthorizationUrl(), token, requestUrl);
    response.sendRedirect(urlBuffer.toString());
    }
    break;

    case Token.UNAUTHORIZED:
    String verifier = request.getParameter(Constants.OAUTH_VERIFIER);
    if(verifier==null)
    {
    // the user has possibly pressed the back button and retried
    // so we redirect and let the user authenticate
    StringBuilder urlBuffer = Transport.buildAuthUrl(
    __yahooEndpoint.getAuthorizationUrl(), token,
    request.getRequestURL().toString());
    Transport.appendToUrl("hd", "default", urlBuffer);
    response.sendRedirect(urlBuffer.toString());
    }
    else if(token.authorize(request.getParameter(Constants.OAUTH_TOKEN), verifier))
    {
    if(fetchAccessToken(token, request, response))
    queryContacts(token, request, response);
    else
    __consumer.saveToken(token, request, response);
    }
    break;

    case Token.AUTHORIZED:
    if(fetchAccessToken(token, request, response))
    queryContacts(token, request, response);
    break;

    case Token.ACCESS_TOKEN:
    queryContacts(token, request, response);
    break;

    default:
    response.sendRedirect(request.getContextPath() + "/oauth/yahoo");
    }
    System.err.println("token: " + token.getState() + " | " + token.getAttributes());
    }

    public boolean fetchAccessToken(Token token, HttpServletRequest request,
    HttpServletResponse response) throws IOException
    {
    // authorized request token
    UrlEncodedParameterMap params = new UrlEncodedParameterMap();

    Response r = __consumer.fetchToken(__yahooEndpoint, params, TokenExchange.ACCESS_TOKEN,
    token);
    if(r.getStatus()==200 && token.getState()==Token.ACCESS_TOKEN)
    {
    // access token
    __consumer.saveToken(token, request, response);
    return true;
    }
    return false;
    }

    void queryContacts(Token token, HttpServletRequest request,
    HttpServletResponse response) throws IOException
    {
    String guid = (String)token.getAttribute("xoauth_yahoo_guid");
    String contactsUrl = "http://social.yahooapis.com/v1/user/" + guid+ "/contacts";
    Response r = serviceGET(contactsUrl, __consumer.getConsumerContext(), __yahooEndpoint,
    token, request, response);

    BufferedReader br = new BufferedReader(new InputStreamReader(r.getInputStream(), "UTF-8"));
    response.setContentType("text/xml");
    PrintWriter pw = response.getWriter();
    for(String line=null; (line=br.readLine())!=null;)
    pw.append(line);
    }

    public static Response serviceGET(String serviceUrl, ConsumerContext context, Endpoint ep,
    Token token, HttpServletRequest request, HttpServletResponse response)
    throws IOException
    {
    HttpConnector connector = context.getHttpConnector();
    UrlEncodedParameterMap params = new UrlEncodedParameterMap(serviceUrl);
    context.getNonceAndTimestamp().put(params, token.getCk());
    Parameter authorization = new Parameter("Authorization",
    HttpAuthTransport.getAuthHeaderValue(params, ep, token,
    context.getNonceAndTimestamp(), ep.getSignature()));
    return connector.doGET(params.getUrl(), authorization);

    }

    }
    0
  • The problem is when the oauth parameters are transported via the "Authorization" header. That's seriously a bug that needs fixing.

    The workaround for my part is that the oauth parameters are transported via normal HTTP GET parameters (query string) instead.

    I've updated http://dyuproject.appspot.com/ with these changes for the mean time. Hopefully, the bug will be fixed sooner.

    Cheers
    0
  • QUOTE (davidyu_ftw @ Oct 13 2009, 08:26 AM) <{POST_SNAPBACK}>
    The problem is when the oauth parameters are transported via the "Authorization" header. That's seriously a bug that needs fixing.

    The workaround for my part is that the oauth parameters are transported via normal HTTP GET parameters (query string) instead.

    I've updated http://dyuproject.appspot.com/ with these changes for the mean time. Hopefully, the bug will be fixed sooner.

    Cheers



    I am too facing the same problem. I have got the access token from yahoo successfully but not getting contacts. Getting the signature invalid problem..

    Initially I thought I was making some mistakes with the baseString or setting oauth parameters in authorization header.
    As there is not enough on yahoo documentation, bryan or davidyu can u please share something about basestring and setting oauth parameters. I may be right on those things but just want to confirm whether I am also on your level.

    Can yahoo developer share something on this as so many people are facing the problem in getting the contacts from yahoo address book....
    1
  • QUOTE (reset21123 @ Oct 13 2009, 08:34 PM) <{POST_SNAPBACK}>
    I am too facing the same problem. I have got the access token from yahoo successfully but not getting contacts. Getting the signature invalid problem..

    Initially I thought I was making some mistakes with the baseString or setting oauth parameters in authorization header.
    As there is not enough on yahoo documentation, bryan or davidyu can u please share something about basestring and setting oauth parameters. I may be right on those things but just want to confirm whether I am also on your level.

    Can yahoo developer share something on this as so many people are facing the problem in getting the contacts from yahoo address book....


    @davidyu_ftw
    Are u getting contacts after passing the oauth parameters with query string...
    Me still getting the same signature invalid problem even when using query string....
    I am passing like this in the brower window ...

    http://social.yahooapis.com/v1/user/hidden...tpfUgN%2BwtY%3D

    is it right...
    0
  • QUOTE (reset21123 @ Oct 13 2009, 08:58 PM) <{POST_SNAPBACK}>
    @davidyu_ftw
    Are u getting contacts after passing the oauth parameters with query string...
    Me still getting the same signature invalid problem even when using query string....
    I am passing like this in the brower window ...

    http://social.yahooapis.com/v1/user/hidden...tpfUgN%2BwtY%3D

    is it right...


    If you're getting a signature invalid problem, you might not have signed the oauth parameters that are appended to the query string.
    The oath library you are using should take care of that for you.
    0
  • QUOTE (davidyu_ftw @ Oct 14 2009, 06:37 AM) <{POST_SNAPBACK}>
    If you're getting a signature invalid problem, you might not have signed the oauth parameters that are appended to the query string.
    The oath library you are using should take care of that for you.


    Can you reply with the full http request and response? Also, what is the signature base string you are using? If you are using a standard oauth client or yahoo sdk it should be fine: http://github.com/yahoo
    0
  • I am facing exactly same problem as this problem.

    I have been through the OAuth process. Then finally I have obtained the "xoauth_yahoo_guid".
    I believe that this guid should be used with

    http://social.yahooapis.com/v1/user/{guid}/contacts

    So I have used the "xoauth_yahoo_guid" in {guid}.

    Then I keep on getting this.
    <?xml version="1.0" encoding="UTF-8" ?>
    - <yahoo:error xmlns:yahoo="http://yahooapis.com/v1/base.rng" xml:lang="en-US">
    <yahoo:description>Please provide valid credentials. OAuth oauth_problem="unable_to_determine_oauth_type", realm="yahooapis.com"</yahoo:description>
    </yahoo:error>

    Is there any way to retrieve the contact? or seriously bug in Yahoo contact API so that there is no way to control the contact data??
    If anyone can answer this, that would be great.

    Thanks,
    Akira
    0
  • QUOTE (Akira @ Jan 5 2010, 09:00 PM) <{POST_SNAPBACK}>
    I am facing exactly same problem as this problem.

    I have been through the OAuth process. Then finally I have obtained the "xoauth_yahoo_guid".
    I believe that this guid should be used with

    http://social.yahooapis.com/v1/user/{guid}/contacts

    So I have used the "xoauth_yahoo_guid" in {guid}.

    Then I keep on getting this.
    <?xml version="1.0" encoding="UTF-8" ?>
    - <yahoo:error xmlns:yahoo="http://yahooapis.com/v1/base.rng" xml:lang="en-US">
    <yahoo:description>Please provide valid credentials. OAuth oauth_problem="unable_to_determine_oauth_type", realm="yahooapis.com"</yahoo:description>
    </yahoo:error>

    Is there any way to retrieve the contact? or seriously bug in Yahoo contact API so that there is no way to control the contact data??
    If anyone can answer this, that would be great.

    Thanks,
    Akira



    Are you including the oauth version in the requests? Are you sending the oauth credentials via http header or query parameters? Can you include the complete http request/response?
    0
  • Thanks for your response.
    QUOTE (Dustin Whittle @ Jan 7 2010, 01:25 AM) <{POST_SNAPBACK}>
    Are you including the oauth version in the requests?
    Are you sending the oauth credentials via http header or query parameters? Can you include the complete http request/response?

    I am afraid that I have not included the oauth version in the request.
    As soon as I have received following parameter as a part of OAuth process (No.4 in document),

    oauth_token=AAA
    oauth_token_secret=BBB
    oauth_expires_in=3600
    oauth_session_handle=CCC
    oauth_authorization_expires_in=884656234
    xoauth_yahoo_guid=DDD

    I have called that
    http://social.yahooapis.com/v1/user/DDD/contacts

    I may not read the documentation carefully...
    How could I include oauth version in the request? and also how could I do
    "sending the oauth credentials via http header or query parameters?"

    Thanks in advance,
    Akira
    0
    • Z
    • Feb 14, 2010
    QUOTE (Akira @ Jan 10 2010, 07:30 PM) <{POST_SNAPBACK}>
    Thanks for your response.

    I am afraid that I have not included the oauth version in the request.
    As soon as I have received following parameter as a part of OAuth process (No.4 in document),

    oauth_token=AAA
    oauth_token_secret=BBB
    oauth_expires_in=3600
    oauth_session_handle=CCC
    oauth_authorization_expires_in=884656234
    xoauth_yahoo_guid=DDD

    I have called that
    http://social.yahooapis.com/v1/user/DDD/contacts

    I may not read the documentation carefully...
    How could I include oauth version in the request? and also how could I do
    "sending the oauth credentials via http header or query parameters?"

    Thanks in advance,
    Akira


    Having the same issue. Once I'm through OAuth (i've got my GUID) and make a GET Request of the Contacts API, I'm seeing the same response as everyone else in this thread.
    0
  • Can anyone please help I can't even get the Auth Token in the first place I keep getting a 401 error. Can anyone please send me a working code example at hardcorehire@yahoo.com or post here any ideas. Here is the code I am using to try and get the auth token

    CODE:

    Uri YahooAuthRequestToken = new Uri("https://api.login.yahoo.com/oauth/v2/get_request_token");

    OAuth.OAuthBase oAuth = new OAuth.OAuthBase();
    string nonce = oAuth.GenerateNonce();
    string timeStamp = oAuth.GenerateTimeStamp();
    string sig = oAuth.GenerateSignature(YahooAuthRequestToken,
    consumerKey, consumerSecret,
    string.Empty, string.Empty,
    "GET", timeStamp, nonce,
    OAuth.OAuthBase.SignatureTypes.HMACSHA1,out normaluri , out normaluriparam);

    sig = HttpUtility.UrlEncode(sig);

    StringBuilder sb = new StringBuilder(YahooAuthRequestToken.ToString());
    sb.AppendFormat("?oauth_callback={0}&", "oob");
    sb.AppendFormat("oauth_consumer_key={0}&", consumerKey);
    sb.AppendFormat("oauth_nonce={0}&", nonce);
    sb.AppendFormat("oauth_timestamp={0}&", timeStamp);
    sb.AppendFormat("oauth_signature_method={0}&", "HMAC-SHA1");
    sb.AppendFormat("oauth_version={0}&", "1.0");
    sb.AppendFormat("oauth_signature={0}", sig.ToString());

    try
    {

    request = WebRequest.Create(sb.ToString()) as HttpWebRequest;


    using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
    {
    StreamReader GetAuthToken = new StreamReader(response.GetResponseStream());
    YahooAuthToken = GetAuthToken.ReadToEnd();
    MessageBox.Show(YahooAuthToken);
    }
    }
    catch (Exception ex)
    {
    MessageBox.Show( "ERROR: " + ex.Message);
    }


    HERE IS THE sb.ToString() in the "request = WebRequest.Create(sb.ToString()) as HttpWebRequest; " LINE:
    https://api.login.yahoo.com/oauth/v2/get_re...llback=oob&
    oauth_consumer_key=dj0yJmk9...(removed for security)...QmeD1kMw--&
    oauth_nonce=4228703&oauth_timestamp=1262890185&oauth_signature_method=HMAC-SHA1&
    oauth_version=1.0&oauth_signature=kSUT6rXzpTgnDwdmbHMAjNQjOZU%3d
    0
  • Great, now I'm stuck here too. I've got the OAuth worked out in Perl, but I can't figure out how I'm suppose to make the API call to work with Yahoo Mail.
    0
  • QUOTE (J @ Apr 15 2011, 08:29 AM) <{POST_SNAPBACK}>
    Great, now I'm stuck here too. I've got the OAuth worked out in Perl, but I can't figure out how I'm suppose to make the API call to work with Yahoo Mail.


    WooHoo!!! I figured it out!!! I posted the Perl code here --
    http://developer.yahoo.net/forum/index.php?showtopic=8868
    0
  • I got my Contacts call to work fine, after some serious looking over the code. What was wrong with mine was that my access token was saved as a string in the table, and not a text (since yahoo's keys are insanely long). When I tried to call the API I would get the signature_invalid error because my base string was missing most of my oauth_token in it.

    See if this is the problem.

    Right now my problem is that the xml response returned only contains the names. guids, and cids, of the contacts, and not the email, birthday, etc. Which is driving me insane because I made two accounts with everything visible to my Connections, and still nadda.

    Anyways, hope I could help.
    0
  • Have a GET Request with HMAC-SHA1 signature method  instead of POST Request with PLAINTEXT signature method would solve this issue. I tried with PHP using zend oauth. I got the contacts.

    Zend code.

    /**
         * Sample method - Delete it once integrated with contacts import
         */
        public function getyahoocontactsAction() {
            if (($oauth = $this->getRequest()->getParam('oauth_token', false)) !== false) {
                $session = new Zend_Session_Namespace("yahoo");
                if ($session->request_token) {
                    $token = unserialize($session->request_token);
                   
                    if ($token && ($token->getToken() == $oauth)) {
                       
                        $config = array(
                            'callbackUrl'         => $this->view->currentBaseUrl . $this->view->url(array('controller' => 'controller_name', 'action'=>'getyahoocontacts'), 'default', true),
                            'siteUrl'             => 'https://api.login.yahoo.com/oauth/v2',
                            'consumerKey'         => 'Your consumer key',
                            'consumerSecret'     => 'Consumer secret key',
                            'accessTokenUrl'     => 'https://api.login.yahoo.com/oauth/v2/get_token',
                            'requestScheme'     => Zend_Oauth::REQUEST_SCHEME_QUERYSTRING,
                            'requestMethod'     => Zend_Oauth::GET,
                            'signatureMethod'     => 'HMAC-SHA1',
                            'version'            => '1.0'
                        );
                       
                        $consumer = new Zend_Oauth_Consumer($config);
           
                        $accessToken = $consumer->getAccessToken($_GET, $token);
                       
                        $session->access_token = serialize($accessToken);
                       
                        $session->request_token = null;
                       
                        $client = $accessToken->getHttpClient($config, 'http://social.yahooapis.com/v1/user/' . $accessToken->getParam('xoauth_yahoo_guid') . '/contacts');
                       
                        $client->setMethod(Zend_Http_Client::GET);
                       
                        $response = $client->request();
                       
                        header('Content-Type: ' . $response->getHeader('Content-Type'));
                       
                        Propel_Helper::log($response->getBody()); exit;
                    }
                    else {
                        $this->_redirect($this->view->url(array('controller'=>'controller_name', 'action' => 'list'), 'default', true));
                    }
                }
                else {
                    $this->_redirect($this->view->url(array('controller'=>'controller_name', 'action' => 'list'), 'default', true));
                }
            }
            else {
                $config = array(
                    'callbackUrl'             => $this->view->currentBaseUrl . $this->view->url(array('controller' => 'controller_name', 'action'=>'getyahoocontacts'), 'default', true),
                    'siteUrl'                 => 'https://api.login.yahoo.com/oauth/v2',
                    'consumerKey'             => 'consumer key',
                    'consumerSecret'         => 'secret key',
                    'requestTokenUrl'         => 'https://api.login.yahoo.com/oauth/v2/get_request_token',
                    'userAuthorizationUrl'     => 'https://api.login.yahoo.com/oauth/v2/request_auth',
                    'requestScheme'         => Zend_Oauth::REQUEST_SCHEME_QUERYSTRING,
                    'requestMethod'         => Zend_Oauth::GET,
                    'signatureMethod'         => 'HMAC-SHA1',
                    'version'                => '1.0'
                );
               
                $consumer = new Zend_Oauth_Consumer($config);
               
                $token = $consumer->getRequestToken();
                Propel_Helper::log(serialize($token));
                $session = new Zend_Session_Namespace("yahoo");
                $session->request_token = serialize($token);

                $consumer->redirect();
            }
        }


    Hope it will be helpful.



    QUOTE(Goran Zivkovic @ 1 Jun 2011 12:59 PM)
    I got my Contacts call to work fine, after some serious looking over the code. What was wrong with mine was that my access token was saved as a string in the table, and not a text (since yahoo's keys are insanely long). When I tried to call the API I would get the signature_invalid error because my base string was missing most of my oauth_token in it.

    See if this is the problem.

    Right now my problem is that the xml response returned only contains the names. guids, and cids, of the contacts, and not the email, birthday, etc. Which is driving me insane because I made two accounts with everything visible to my Connections, and still nadda.

    Anyways, hope I could help.
    0

  • Hello,
    can anyone pls send me the code to get contacts of yahoo and gmail using OAuth ..
    Thanks
    0
  • @Karthikeyan: I have been spend a lot of hours on this and I could spent a lot more if weren't you. Thank you man! Great answer. It seems that zend simplifies the things a lot .

    0
  • Facing the same issue since 2 days.. I have gone through 4 steps of OAuth. But when I'm trying to continue with which is given here http://developer.yahoo.com/oauth/guide/oauth-make-request.html

    String yahoo_API_request_url = "http://social.yahooapis.com/v1/user/" xoauth_yahoo_guid "/profile?format=json&"
                      "realm=yahooapis.com"
                      "&oauth_consumer_key="
                      oauth_consumer_key
                      "&oauth_nonce="
                      oauth_nonce
                      "&oauth_signature_method=HMAC-SHA1"
                      "&oauth_timestamp="
                      (System.currentTimeMillis()   600)
                      "&oauth_token="
                      oauth_token
                      "&oauth_version="
                      oauth_version
                      "&oauth_signature=5934d83aee733bf51879bee56fd4834%3D";
            url = new URL(yahoo_API_request_url);
            conn = url.openConnection();
            // Get the response
            rd = new BufferedReader(new InputStreamReader(conn
                    .getInputStream()));
    

    after this I'm getting ~~~ Server returned HTTP response code: 401 for URL: http://social.yahooapis.com/v1/user/QUDCNAIRCLFGXNDO6SCFQ/profile?format=json&realm=yahooapis.com&oauth_consumer_key=dj0yJmk9a0U5tNU1Oa1pUTnpZbWNHbzlNakE1TURZek5qQTJNZy0tJnM9Y29uc3VtZXJzZWNyZXQmeD1mYg--&oauth_nonce=ce2130314ed3965ea6&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1355392416080&oauth_token=A%3D4br4nzjt6hYa3qwZ08ACrQYgXMQhBexcP ~~~ Where I'm doing wrong? Please help.

    0
  • Hi Karthikeyan, Can you send me the zend code plz on anand@techaheadcorp.com

    Thanks a lot!

    0
  • can any give the working example to fetch the contacts in JAVA , basically i need name and email addresses if i provide email address and password of any user Email :"test@test.com" password :"********" could fetch me the details.

    0
  • what is Propel_Helper class . i don't find this class in zend.

    0
  • Hi I am using this code for get contact list from yahoo api but i am getting 401 error, any one can help me. string outUrl = ""; string querystring = ""; Uri uri = new Uri("http://social.yahooapis.com/v1/user/" + oauth_yahoo_guid + "/contacts?format=XML"); string nonce = this.GenerateNonce(); string timeStamp = this.GenerateTimeStamp();

            string sig = this.GenerateSignature(uri,
                this.ConsumerKey,
                this.ConsumerSecret,
                this.Token,
                this.TokenSecret,
                string.Empty,
                this.Verifier,
                Method.POST.ToString(),
                timeStamp,
                nonce,
                out outUrl,
                out querystring);
    
            StringBuilder sbGetContacts = new StringBuilder(uri.ToString());
    
            try
            {
                string returnStr = string.Empty;
    
                HttpWebRequest req = System.Net.WebRequest.Create(sbGetContacts.ToString()) as HttpWebRequest;
                req.Method = "GET";
    
                string authHeader = "Authorization: OAuth " +
                "realm=\"yahooapis.com\"" +
                ",oauth_consumer_key=\"" + ConsumerKey + "\"" +
                ",oauth_nonce=\"" + nonce + "\"" +
               ",oauth_signature_method=\"PLAINTEXT\"" +
                ",oauth_timestamp=\"" + timeStamp + "\"" +
                ",oauth_token=\"" + Token + "\"" +
                ",oauth_version=\"1.0\"" +
                ",oauth_signature=\"" + HttpUtility.UrlEncode(sig) + "\"";
    
                //Response.Write("</br>Headers: " + authHeader);
    
                req.Headers.Add(authHeader);
    
                HttpWebResponse res = (HttpWebResponse)req.GetResponse();
                StreamReader streamReader = new StreamReader(res.GetResponseStream());
                returnStr = streamReader.ReadToEnd();
                XmlDocument xmldoc = new XmlDocument();
                xmldoc.LoadXml(returnStr);
                XmlNodeList elemList = xmldoc.DocumentElement.GetElementsByTagName("fields");
    
    
                for (int i = 0; i < elemList.Count; i++)
                {
                    if (elemList[i].ChildNodes[1].InnerText == "email")
                        emails.Add(elemList[i].ChildNodes[2].InnerText);
                    //Response.Write(elemList[i].ChildNodes[2].InnerText + "<br/>");
                }
    
    0
  • Hi there, just switch your URL to secure HTTP. That should work. https://social.yahoo...

    Greetings!

    0

Recent Posts

in Contacts