Index: Src/GoogleApis.Auth.WinRT/OAuth2/AuthorizationCodeWinRTInstalledApp.cs
===================================================================
--- a/Src/GoogleApis.Auth.WinRT/OAuth2/AuthorizationCodeWinRTInstalledApp.cs
+++ b/Src/GoogleApis.Auth.WinRT/OAuth2/AuthorizationCodeWinRTInstalledApp.cs
@@ -31,15 +31,25 @@
///
public sealed class AuthorizationCodeWinRTInstalledApp : IAuthorizationCodeInstalledApp
{
- private IAuthorizationCodeInstalledApp innerInstallApp;
+ private readonly IAuthorizationCodeInstalledApp innerInstallApp;
- private readonly AuthorizationCodeFlow.Initializer authorizationCodeFlowInitializer;
-
- /// Constructs a new authorization code installed application for Windows Store.
- /// A authorization code flow initializer
+ ///
+ /// Constructs a new authorization code for Windows Store application targeting an installed application flow.
+ ///
+ /// An authorization code flow initializer.
public AuthorizationCodeWinRTInstalledApp(AuthorizationCodeFlow.Initializer authorizationCodeFlowInitializer)
{
- this.authorizationCodeFlowInitializer = authorizationCodeFlowInitializer;
+ innerInstallApp = new AuthorizationCodeInstalledApp(
+ new AuthorizationCodeFlow(authorizationCodeFlowInitializer), new AuthorizationCodeBroker());
+ }
+
+ ///
+ /// Constructs a new authorization code for Windows Store application targeting an installed application flow.
+ ///
+ /// An authorization code flow.
+ public AuthorizationCodeWinRTInstalledApp(IAuthorizationCodeFlow flow)
+ {
+ innerInstallApp = new AuthorizationCodeInstalledApp(flow, new AuthorizationCodeBroker());
}
#region IAuthorizationCodeInstalledApp Members
@@ -56,12 +66,6 @@
public async Task AuthorizeAsync(string userId, CancellationToken taskCancellationToken)
{
- if (innerInstallApp == null)
- {
- innerInstallApp = new AuthorizationCodeInstalledApp(
- new AuthorizationCodeFlow(authorizationCodeFlowInitializer), new AuthorizationCodeBroker());
- }
-
return await innerInstallApp.AuthorizeAsync(userId, taskCancellationToken).ConfigureAwait(false);
}