Iām trying to write my own Google Calendar calendar access application. I am trying to use the example that Google provided for authentication, but it never starts the authentication function
private void Window_Initialized(object sender, EventArgs e) { var provider = new NativeApplicationClient( GoogleAuthenticationServer.Description); provider.ClientIdentifier = "<My Client Id here>"; provider.ClientSecret = "<My Client Secret here"; var auth = new OAuth2Authenticator<NativeApplicationClient>( provider, (p) => GetAuthorization(provider)); CalendarService service = new CalendarService(); CalendarsResource.GetRequest cr = service.Calendars.Get("{primary}"); if (cr.CalendarId != null) { Console.WriteLine("Fetching calendar");
Here is the code I use for authentication. I never see a publication in the console.
private static IAuthorizationState GetAuthorization(NativeApplicationClient arg) { Console.WriteLine("Authorization Requested"); IAuthorizationState state = new AuthorizationState( new[] { CalendarService.Scopes.Calendar.GetStringValue() }); state.Callback = new Uri(NativeApplicationClient.OutOfBandCallbackUrl); Uri authUri = arg.RequestUserAuthorization(state); Process.Start(authUri.ToString());
Are there any better tutorials or am I doing something wrong?
source share