/// <summary>Asynchronously authorizes the specified user.</summary> /// <remarks> /// It uses <seealso cref="Google.Apis.Util.Store.StroageDataStore"/> as the flow's data store by default. /// </remarks> /// <param name="clientSecrets">The client secrets URI.</param> /// <param name="scopes"> /// The scopes which indicate the Google API access your application is requesting. /// </param> /// <param name="user">The user to authorize.</param> /// <param name="taskCancellationToken">Cancellation token to cancel an operation.</param> /// <returns>User credential.</returns> private static async Task<UserCredential> AuthorizeAsync(ClientSecrets clientSecrets, IEnumerable<string> scopes, string user, CancellationToken taskCancellationToken) { var initializer = new GoogleAuthorizationCodeFlow.Initializer { ClientSecrets = clientSecrets, Scopes = scopes, DataStore = new StroageDataStore() }; var installedApp = new AuthorizationCodeWinRTInstalledApp(initializer); return await installedApp.AuthorizeAsync(user, taskCancellationToken).ConfigureAwait(false); }
/// <summary>Asynchronously authorizes the specified user.</summary> /// <remarks> /// It uses <see cref="Google.Apis.Util.Store.StroageDataStore"/> as the flow's data store by default. /// </remarks> /// <param name="clientSecrets">The client secrets URI.</param> /// <param name="scopes"> /// The scopes which indicate the Google API access your application is requesting. /// </param> /// <param name="user">The user to authorize.</param> /// <param name="taskCancellationToken">Cancellation token to cancel an operation.</param> /// <returns>User credential.</returns> private static async Task <UserCredential> AuthorizeAsync(ClientSecrets clientSecrets, IEnumerable <string> scopes, string user, CancellationToken taskCancellationToken) { var initializer = new GoogleAuthorizationCodeFlow.Initializer { ClientSecrets = clientSecrets, Scopes = scopes, DataStore = new StroageDataStore() }; var installedApp = new AuthorizationCodeWinRTInstalledApp(initializer); return(await installedApp.AuthorizeAsync(user, taskCancellationToken).ConfigureAwait(false)); }