Sequencing.WeatherApp.Controllers.OAuth.AuthWorker.GetAuthInfo C# (CSharp) Method

GetAuthInfo() public method

Second step in OAuth initial authorization sequence.
public GetAuthInfo ( string code ) : AuthInfo
code string code parameter acquired from OAuth server
return AuthInfo
        public AuthInfo GetAuthInfo(string code)
        {
            var _webRequest = CreateRq();
            try
            {
                using (var _str = _webRequest.GetRequestStream())
                using (var _sw = new StreamWriter(_str))
                {
                    _sw.Write("grant_type={0}&code={1}&redirect_uri={2}", "authorization_code", code,
                        HttpUtility.UrlEncode(redirectUrl));
                    _sw.Flush();
                }
                var _webResponse = _webRequest.GetResponse();
                using (var _stream = _webResponse.GetResponseStream())
                {
                    if (_stream == null)
                        throw new Exception("Response  stream was null");
                    using (var _sr = new StreamReader(_stream))
                    {
                        var _readToEnd = _sr.ReadToEnd();
                        var _res = SimpleJson.DeserializeObject<TokenInfo>(_readToEnd);
                        return new AuthInfo {Success = true, Token = _res};
                    }
                }
            }
            catch (WebException _ex)
            {
                using (var _rs = _ex.Response.GetResponseStream())
                using (var _sr = new StreamReader(_rs))
                {
                    var _readToEnd = _sr.ReadToEnd();
                    return new AuthInfo { Success = false, ErrorMessage = "Error while retrieving token, HTTP:" + _ex.Status + ":" + _readToEnd };
                }
            }
        }