사용자 Google 캘린더에 액세스하기위한 기본 앱을 작성하려고합니다. 나는 구글이 인증을 얻기 위해 제공하고있는 예제를 사용하려고하지만 결코 인증 기능 여기Google 인증 프로세스
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");
//Google.Apis.Calendar.v3.Data.Calendar c =
service.Calendars.Get("{primary}").Fetch();
}
else
{
Console.WriteLine("Service not found");
}
}
에게 해고 것 같다 것은 내가 인증에 사용하고있는 코드입니다. 나는 콘솔 writeline이 공개되는 것을 결코 보지 못한다.
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());
// Request authorization from the user and get the code
string authCode = Console.ReadLine();
// Retrieve the access token by using the authorization code:
return arg.ProcessUserAuthorization(authCode, state);
}
더 나은 자습서가 있습니까? 아니면 내가 잘못하고 있습니까?
동일한 문제가 발생했기 때문에이 문제를 해결할 수 있었습니까? – Varun