Google Oauth Bad request ...Please Help

20 views
Skip to first unread message

Deepak VS

unread,
Mar 6, 2012, 5:55:23 AM3/6/12
to gwt-oaut...@googlegroups.com
Hi All,

I was successfully in retrieving the token provided by gmail.However I am not able to get the user info details like first name,lastname etc.


Please Help Me

Here is the code snipet

string sreq = "https://www.google.com/accounts/ClientLogin?accountType=HOSTED_OR_GOOGLE&Email=" + username + "&Passwd=" + password + "&service=analytics&source=test-test-v1" + "Scope= https://www.googleapis.com/auth/userinfo.profile";
            HttpWebRequest req = (HttpWebRequest)WebRequest.Create(sreq);
            HttpWebResponse res = (HttpWebResponse)req.GetResponse();
            Stream responseBody = res.GetResponseStream();
            Encoding encode = System.Text.Encoding.GetEncoding("utf-8");
            StreamReader readStream = new StreamReader(responseBody, encode);
            string loginStuff = readStream.ReadToEnd();
            string SID = loginStuff.Substring(0, loginStuff.IndexOf("LSID")).Replace("SID=", "").TrimEnd('\n');
            string LSID = loginStuff.Substring(loginStuff.IndexOf("LSID"), (loginStuff.IndexOf("Auth") - loginStuff.IndexOf("LSID"))).Replace("LSID=", "").TrimEnd('\n');
Token= loginStuff.Substring(loginStuff.IndexOf("Auth")).Replace("Auth=", "").TrimEnd('\n');



After this I call a method to get user info


                HttpWebRequest req = (HttpWebRequest)WebRequest.Create(Newrl);
                req.Method = "GET";
                HttpWebResponse res = (HttpWebResponse)req.GetResponse();
                Stream responseBody = res.GetResponseStream();
                Encoding encode = System.Text.Encoding.GetEncoding("utf-8");

How ever I get error at the Bold line...please help me

Jason Hall

unread,
Mar 6, 2012, 8:58:31 AM3/6/12
to gwt-oaut...@googlegroups.com
This appears to have nothing to do with the https://code.google.com/p/gwt-oauth2 project...

- Jason
Reply all
Reply to author
Forward
0 new messages