c# 4.0 - Authentication for Box in C# 4.0 -
I am trying to use token using the code below in the C # language, but I have 400 bad requests exception Are getting .
Code: But always the following Tru : "Invalid": "invalid_request", "error_description": "missing invalid grant_type parameter or parameter"} This problem How to remove? Any help would be appreciated thanks in advance. Thanks, Harish Reddy I see two possible problems, both with this line: WebRequest httpWReq = WebRequest.Create ("https://www.box.com/api/oauth2/token"); String postData = "grant_type = authorization_code"; PostData + "" & amp; Code = "+ code; postdata +" "& amp; customer_id = MY_CLIENT_ID"; PostData + "& amp; client_secret = MY_CLIENT_SECRET"; PostData + "" & amp; Redirect_uri = https: //www.google.com "; byte [] data = encoding. UTF8.GetBytes (PostData); HttpWReq.Method =" POST "; HttpWReq.ContentType =" application / x-www-form-urlencoding " ;); Stream.Write (data, 0, data. Lang);} Var response = httpWReq.GetResponse (); Var responseflow = response using the HttpWReq.ContentLength = data.Length; (stream stream = httpWReq.GetRequestStream ()) Gaterespanstream (); (Var Reader = Using new streamminder (responses) {var responseReader = reader.ReadToEnd (); MessageBox.Show (responseReader);}
postData + = "& redirect_uri = https: // www .google.com ";
Comments
Post a Comment