title: How do I write a VB or C# GUI client for DotNetOpenAuth?
body: <p>I am learning how to use the Google Calendar API, which in turn requires that I learn how to use DotNetOpenAuth to access the Google account.  I made the provided samples work, and have written working code in a Console program to access and manipulate a Calendar.</p>
  
  <p>I now want to write a Windows Form app (in either C# or VB) to do the same thing.  I can't make the OAuth2 process work in the GUI application.  It compiles and runs, but does not work.  Based on what I've seen so far, I have concluded that the GetAuthorization() function is not called.</p>
  
  <p>I've tried starting the process from a button click, from the constructor, and from the form Loader method.  I've tried in both C# and VB.  </p>
  
  <pre><code>public GoogleCal()
  {
      InitializeComponent();
  
      var provider = new NativeApplicationClient(
                             GoogleAuthenticationServer.Description);
      provider.ClientIdentifier = "xxxxx.apps.googleusercontent.com";
      provider.ClientSecret = "yyyyy";
  
      var auth = new OAuth2Authenticator&lt;NativeApplicationClient&gt;(
                         provider, GetAuthorization);
  }
  
  private IAuthorizationState GetAuthorization(NativeApplicationClient arg)
  {
      // Get the auth URL:
      IAuthorizationState state = new AuthorizationState(new[] {
                                 CalendarService.Scopes.Calendar.GetStringValue() });
  
      state.Callback = new Uri(NativeApplicationClient.OutOfBandCallbackUrl);
      Uri authUri = arg.RequestUserAuthorization(state);
  
      // Request authorization from the user (by opening a browser window):
      Process.Start(authUri.ToString());
      authCodeText = Microsoft.VisualBasic.Interaction.InputBox(
                                                     "Paste code:", "title", "");
  
      // Retrieve the access token by using the authorization code:
      return arg.ProcessUserAuthorization(authCodeText, state);
  }
  </code></pre>
  
  <p>I'm obviously doing something wrong, but I can't figure out what it is.  Any ideas?</p>