title: How to get authorization code for Xero OAuth2.0
body: <p>I'm using Xero with c# winforms. Xero released a new topic OAuth2.0 and they are providing sample only for web applications. But I didn't get authorization code. I'm getting an html page as response not the authorization code. Can anyone help me? Thanks for the help in advance.</p>
  
  <p>Here is my current code for getting authorization code:</p>
  
  <pre><code>string XeroUrl = "login.xero.com/identity/connect/authorize?response_type=code&amp;client_id=xxxxxxxxxxxx&amp;redirect_uri=xxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; 
  string ScopeLimit = "openid profile email accounting.transactions&amp;state=123"; 
  string URL = "https://" + XeroUrl + "&amp;scope=" + ScopeLimit; 
  try { 
      HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(URL); 
      webRequest.AllowAutoRedirect = true; 
      webRequest.Method = WebRequestMethods.Http.Get; 
      webRequest.UseDefaultCredentials = false; 
      webRequest.PreAuthenticate = false; 
      HttpWebResponse response = null; 
      response = (HttpWebResponse)webRequest.GetResponse(); 
      StreamReader reader = new StreamReader(response.GetResponseStream()); 
      string output = reader.ReadToEnd(); 
  }
  </code></pre>