HI
I am trying to get the request token from google to get the playlist
of the user .
this is the code I am using

string  signature = objOAuthBase.GenerateSignature(uri,
objOAuthBase.UrlEncode(service.ConsumerKey), service.ConsumerSecret,
"", "", "GET", timestamp, nonce, out normalisedurl, out
normalisedparameters);
       signature = objOAuthBase.UrlEncode(signature);
       StringBuilder authHeader = new StringBuilder();
       authHeader.Append("OAuth oauth_version=\"1.0\", ");
       authHeader.Append("oauth_nonce=\"");
       authHeader.Append(nonce);
       authHeader.Append("\", ");
       authHeader.Append("oauth_timestamp=\"");
       authHeader.Append(timestamp);
       authHeader.Append("\", ");
       authHeader.Append("oauth_consumer_key=\"");
       authHeader.Append(service.ConsumerKey);
       authHeader.Append("\", ");
       //authHeader.Append("oauth_callback=\"");
       //authHeader.Append(callback);
       //authHeader.Append("\", ");
       authHeader.Append("oauth_signature_method=\"");
       authHeader.Append(service.SignatureMethod);
       authHeader.Append("\", ");
       authHeader.Append("oauth_signature=\"");
       authHeader.Append(signature);
       authHeader.Append("\"");
       string strAuthHeader = authHeader.ToString();
       string requestUrl = "";

       if (string.IsNullOrEmpty(scope))
       {
           requestUrl = service.RequestTokenUrl;
       }
       else
       {
           QueryDataCollection path = new QueryDataCollection();
           path.Add(new QueryData("scope", scope));
           requestUrl = path.ToString(service.RequestTokenUrl);
       }
           Uri uri1 = new Uri(requestUrl);
           try
           {
               HttpWebRequest objhttp = (HttpWebRequest)
WebRequest.Create(uri1);
               objhttp.ContentType = "application/x-www-form-
urlencoded";
               objhttp.Accept = "*/*";
               //objhttp.ContentLength = 0;

               objhttp.KeepAlive = true;
               objhttp.Method = "GET";
               objhttp.Headers.Add("Authorization", strAuthHeader);
               HttpWebResponse objresp = (HttpWebResponse)
objhttp.GetResponse();
               StreamReader sr = new StreamReader
(objresp.GetResponseStream());
               string response = sr.ReadToEnd();
               QueryDataCollection str = new QueryDataCollection
(response);
               QueryData objqueryData = str.GetQueryDataByName
("oauth_token");
               if (objqueryData != null)
               {
                   requestToken = objqueryData.value;
                   //requestToken = requestToken.Substring(0,
requestToken.Length - 1);
               }
               else
               {

               }
               sr.Close();
           }

           catch (WebException e)
           {
               string estr = e.ToString();

               StreamReader srError = new StreamReader
(e.Response.GetResponseStream());
               string responseError = srError.ReadToEnd();
including the parameters in Heaader :
OAuthorization: OAuth oauth_version="1.0", oauth_nonce="8531634",
oauth_timestamp="1264766288", oauth_consumer_key="www.MyWebsite.com",
oauth_signature_method="HMAC-SHA1",
oauth_signature="Iq6zrSRXUhjI11VHcnVmq1Z03Oc%3D"
The above code works fine with the Twitter API but doesnt work with
the Google.

I am getting bad request from the service provider 400.

also Signature_invalid

base_string :
GET&https%3A%2F%2Fwww.google.com%2Faccounts%2FOAuthGetRequestToken&
oauth_consumer_key%3Dwww.MyWebsite.com%26
oauth_nonce%3D300458%26
oauth_signature_method%3DHMAC-SHA1%26
oauth_timestamp%3D1264687595%26
oauth_version%3D1.0%26
scope%3Dhttp%253A%252F%252Fgdata.youtube.com

-- 
You received this message because you are subscribed to the Google Groups 
"OAuth" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/oauth?hl=en.

Reply via email to