shrhoads / gwt-oauth2

OAuth2 Client Bindings for the GWT generated javascript
Apache License 2.0
0 stars 0 forks source link

error in code please help #61

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hello,

I am using .net C# and i want to insert,update and delete share contacts in our 
domain email.

I tried with authsub but if I am getting error if i try to retrieve shared 
contacts.I can retrieve all personal contacts but i am unable to retrieve 
shared contacts.

Please help,

below is my code,

  String token = Request.QueryString["token"];
            Session["token"] = token;
            HttpWebResponse response = null;
            string authSubToken = "";
            string sessionUrl = getSessionTokenUrl("https", "www.google.com");
            Uri uri = new Uri(sessionUrl);
            HttpWebRequest request = WebRequest.Create(uri) as HttpWebRequest;
             Session["header"] = formAuthorizationHeader(Session["token"].ToString(), null, uri, "GET");
             request.Headers.Add(Session["header"].ToString());
             request.Headers.Add("GData-Version: 3.0");
            response = request.GetResponse() as HttpWebResponse;

            if (response != null)
            {
                int code = (int)response.StatusCode;
                if (code != 200)
                {

                }

                // get the body and parse it
                authSubToken = Utilities.ParseValueFormStream(response.GetResponseStream(), GoogleAuthentication.AuthSubToken);
            }

            Session["newtoken"]= authSubToken;

and then i am trying to retrieve contacts by,

HttpWebResponse response = null;
        string sessionUrl = "https://www.google.com/m8/feeds/contacts/default/full";
        Uri uri = new Uri(sessionUrl);
        HttpWebRequest request = WebRequest.Create(uri) as HttpWebRequest;

       request.ContentType = "application/x-www-form-urlencoded";
        request.UserAgent = "Java/1.5.0_06";
        request.Host = "www.google.com";
        request.Accept = "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2";
        request.KeepAlive = true;
        request.Method = "GET";
        string header = formAuthorizationHeader(Session["newtoken"].ToString(), null, uri, "GET");
        request.Headers.Add(header);

        //request.Headers.Add(Session["header"].ToString());        
       response = request.GetResponse() as HttpWebResponse;

above is working but if i change url by

https://www.google.com/m8/feeds/contacts/mydomain.com/full

then I am getting error .

Please please please help me,

Thanks
Foram

Original issue reported on code.google.com by forampar...@gmail.com on 4 Sep 2012 at 6:38

GoogleCodeExporter commented 9 years ago
This report has nothing to do with this project.

Original comment by jasonhall@google.com on 5 Apr 2013 at 1:55