diff --git a/ChangeLog.md b/ChangeLog.md index 05433a5c..c5ae2cd3 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -24,6 +24,7 @@ * Authentication * Addressed issue preventing the [Test-PartnerSecurityRequirement](https://docs.microsoft.com/powershell/module/partnercenter/test-partnersecurityrequirement) command from working as expected + * Addressed issue [#186](https://github.com/microsoft/Partner-Center-PowerShell/issues/186) that was preventing access token from being generated when using the device code flow ## 2.0.1911.2 diff --git a/src/PowerShell/Authenticators/DeviceCodeAuthenticator.cs b/src/PowerShell/Authenticators/DeviceCodeAuthenticator.cs index 7f6b97ca..cc6e40d5 100644 --- a/src/PowerShell/Authenticators/DeviceCodeAuthenticator.cs +++ b/src/PowerShell/Authenticators/DeviceCodeAuthenticator.cs @@ -4,7 +4,6 @@ namespace Microsoft.Store.PartnerCenter.PowerShell.Authenticators { using System; - using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using Extensions; @@ -28,17 +27,11 @@ public override Task AuthenticateAsync(AuthenticationParam { IPublicClientApplication app = GetClient(parameters.Account, parameters.Environment).AsPublicClient(); - return GetResponseAsync(app, parameters.Scopes, promptAction, cancellationToken); - } - - private async Task GetResponseAsync(IPublicClientApplication app, IEnumerable scopes, Action promptAction = null, CancellationToken cancellationToken = default) - { - return await app.AcquireTokenWithDeviceCode(scopes, deviceCodeResult => + return app.AcquireTokenWithDeviceCode(parameters.Scopes, deviceCodeResult => { - promptAction(deviceCodeResult.Message); + Console.WriteLine(deviceCodeResult.Message); return Task.CompletedTask; }).ExecuteAsync(cancellationToken); - } /// diff --git a/src/PowerShell/Commands/GetPartnerUser.cs b/src/PowerShell/Commands/GetPartnerUser.cs index 11cb485b..52f0b3bf 100644 --- a/src/PowerShell/Commands/GetPartnerUser.cs +++ b/src/PowerShell/Commands/GetPartnerUser.cs @@ -4,8 +4,8 @@ namespace Microsoft.Store.PartnerCenter.PowerShell.Commands { using System.Management.Automation; - using Models.Authentication; using Models; + using Models.Authentication; [Cmdlet(VerbsCommon.Get, "PartnerUser"), OutputType(typeof(Microsoftgraphuser))] public class GetPartnerUser : PartnerCmdlet diff --git a/src/PowerShell/Commands/TestPartnerSecurityRequirement.cs b/src/PowerShell/Commands/TestPartnerSecurityRequirement.cs index 0e675803..af8173c5 100644 --- a/src/PowerShell/Commands/TestPartnerSecurityRequirement.cs +++ b/src/PowerShell/Commands/TestPartnerSecurityRequirement.cs @@ -69,7 +69,7 @@ protected override void ProcessRecord() environment, new[] { $"{environment.PartnerCenterEndpoint}/user_impersonation" }, Message, - WriteWarning, + WriteWarning, CancellationToken);