Skip to content
This repository was archived by the owner on Jul 22, 2024. It is now read-only.

Commit 6c694a6

Browse files
author
Isaiah Williams
authored
Addressing device code flow issue and performing minor code cleanup (#187)
1 parent e11c8ac commit 6c694a6

4 files changed

Lines changed: 5 additions & 11 deletions

File tree

ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
* Authentication
2626
* Addressed issue preventing the [Test-PartnerSecurityRequirement](https://docs.microsoft.com/powershell/module/partnercenter/test-partnersecurityrequirement) command from working as expected
27+
* 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
2728

2829
## 2.0.1911.2
2930

src/PowerShell/Authenticators/DeviceCodeAuthenticator.cs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
namespace Microsoft.Store.PartnerCenter.PowerShell.Authenticators
55
{
66
using System;
7-
using System.Collections.Generic;
87
using System.Threading;
98
using System.Threading.Tasks;
109
using Extensions;
@@ -28,17 +27,11 @@ public override Task<AuthenticationResult> AuthenticateAsync(AuthenticationParam
2827
{
2928
IPublicClientApplication app = GetClient(parameters.Account, parameters.Environment).AsPublicClient();
3029

31-
return GetResponseAsync(app, parameters.Scopes, promptAction, cancellationToken);
32-
}
33-
34-
private async Task<AuthenticationResult> GetResponseAsync(IPublicClientApplication app, IEnumerable<string> scopes, Action<string> promptAction = null, CancellationToken cancellationToken = default)
35-
{
36-
return await app.AcquireTokenWithDeviceCode(scopes, deviceCodeResult =>
30+
return app.AcquireTokenWithDeviceCode(parameters.Scopes, deviceCodeResult =>
3731
{
38-
promptAction(deviceCodeResult.Message);
32+
Console.WriteLine(deviceCodeResult.Message);
3933
return Task.CompletedTask;
4034
}).ExecuteAsync(cancellationToken);
41-
4235
}
4336

4437
/// <summary>

src/PowerShell/Commands/GetPartnerUser.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
namespace Microsoft.Store.PartnerCenter.PowerShell.Commands
55
{
66
using System.Management.Automation;
7-
using Models.Authentication;
87
using Models;
8+
using Models.Authentication;
99

1010
[Cmdlet(VerbsCommon.Get, "PartnerUser"), OutputType(typeof(Microsoftgraphuser))]
1111
public class GetPartnerUser : PartnerCmdlet

src/PowerShell/Commands/TestPartnerSecurityRequirement.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ protected override void ProcessRecord()
6969
environment,
7070
new[] { $"{environment.PartnerCenterEndpoint}/user_impersonation" },
7171
Message,
72-
WriteWarning,
72+
WriteWarning,
7373
CancellationToken);
7474

7575

0 commit comments

Comments
 (0)