Guyz i have implemented a Android push notification service using Asp.net Mvc 3, Google C2DM with OAuth 2.0.
At the point of time of implementation it was working fine. Now after starting the testing , Suddenly from yesterday i have been getting invalid_request error saying response_type parameter is missing. 
I am not able to understand how to tackle this issue
Code:
public string GetAuthenticationCode()
{
string returnUrl = "";
string URL = " https://accounts.google.com/o/oauth2/auth";
NameValueCollection postFieldNameValue = new NameValueCollection();
postFieldNameValue.Add("response_type", "code");
postFieldNameValue.Add("client_id", "xxxxxxxxxxx.apps.googleusercontent.com");
postFieldNameValue.Add("redirect_uri", "http://localhost:49882/TestServer/test");
postFieldNameValue.Add("scope", "https://android.apis.google.com/c2dm/send");
postFieldNameValue.Add("state", "profile");
postFieldNameValue.Add("access_type", "offline");
postFieldNameValue.Add("approval_prompt", "force");
//Had a doubt the request is cached so added this for the same.
postFieldNameValue.Add("additional_param", DateTime.Now.Ticks.ToString());
string postData = GetPostStringFrom(postFieldNameValue);
byte[] byteArray = Encoding.UTF8.GetBytes(postData);
HttpWebRequest Request = (HttpWebRequest)WebRequest.Create(URL);
Request.Method = "POST";
Request.KeepAlive = false;
Request.ContentType = "application/x-www-form-urlencoded;charset=UTF-8";
Request.ContentLength = byteArray.Length;
Stream dataStream = Request.GetRequestStream();
// Write the data to the request stream.
dataStream.Write(byteArray, 0, byteArray.Length);
// Close the Stream object.
dataStream.Close();
try
{
ServicePointManager.ServerCertificateValidationCallback = new System.Net.Security.RemoteCertificateValidationCallback(AcceptAllCertifications);
WebResponse Response = Request.GetResponse();
var sr = new StreamReader(Response.GetResponseStream());
// Debug.WriteLine(sr.ReadToEnd());
// returnUrl = sr.ReadToEnd();
returnUrl = Response.ResponseUri.ToString();
}
catch(WebException wex)
{
var sr = new StreamReader(wex.Response.GetResponseStream());
Debug.WriteLine(sr.ReadToEnd());
throw;
}
return returnUrl;
}
Other thing is I also tried to make a request after removing the response_type parameter but in that case it will throw Web Exception - Bad request.
access_type : auto is also not working.
I tried to get the content of the response stream and returned as content , it shows google sign in page . If we give the authentication details in there manually it will work . So i am stuck to implement the same . Please help.
--
You received this message because you are subscribed to the Google Groups "oauth2-dev" group.
To view this discussion on the web visit https://groups.google.com/d/msg/oauth2-dev/-/pU-6sjxk7x4J.
To post to this group, send email to oauth...@googlegroups.com.
To unsubscribe from this group, send email to oauth2-dev+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/oauth2-dev?hl=en.
Param = "response_type",value= "code"
Param = "client_id",value = "xxxxxxxxxxx.apps.googleusercontent.com"
Param = "redirect_uri",value = "http://localhost:49882/TestServer/test"
Param = "scope",value = "https://android.apis.google.com/c2dm/send"
Param = "state",value = "profile"
Param = "access_type",value = "offline"
Param = "approval_prompt",value = "force"Response Has the Uri as above.