From da27ee5821402c70c89213b306ff795801c8a304 Mon Sep 17 00:00:00 2001 From: Mark Zuber Date: Fri, 26 Oct 2018 14:35:48 -0700 Subject: [PATCH] Update device code request to include device_code (#1359) * update device code request to include device_code * changelog --- core/src/OAuth2/OAuthConstants.cs | 1 + msal/changelog.txt | 5 +++++ .../Features/DeviceCode/DeviceCodeRequest.cs | 3 +++ 3 files changed, 9 insertions(+) diff --git a/core/src/OAuth2/OAuthConstants.cs b/core/src/OAuth2/OAuthConstants.cs index 94f12dbe3..9b73e5a1e 100644 --- a/core/src/OAuth2/OAuthConstants.cs +++ b/core/src/OAuth2/OAuthConstants.cs @@ -39,6 +39,7 @@ internal class OAuth2Parameter public const string RedirectUri = "redirect_uri"; public const string Resource = "resource"; public const string Code = "code"; + public const string DeviceCode = "device_code"; public const string Scope = "scope"; public const string Assertion = "assertion"; public const string RequestedTokenUse = "requested_token_use"; diff --git a/msal/changelog.txt b/msal/changelog.txt index f19b1e1b4..6c462efed 100644 --- a/msal/changelog.txt +++ b/msal/changelog.txt @@ -1,3 +1,8 @@ +2.3.1-preview +============= +This release includes: +- Fix for device code flow where server is now expecting device_code as the body parameter. + 2.3.0-preview ============= This release includes: diff --git a/msal/src/Microsoft.Identity.Client/Features/DeviceCode/DeviceCodeRequest.cs b/msal/src/Microsoft.Identity.Client/Features/DeviceCode/DeviceCodeRequest.cs index 1fe719530..615bef9fd 100644 --- a/msal/src/Microsoft.Identity.Client/Features/DeviceCode/DeviceCodeRequest.cs +++ b/msal/src/Microsoft.Identity.Client/Features/DeviceCode/DeviceCodeRequest.cs @@ -135,6 +135,9 @@ private Dictionary GetBodyParameters(DeviceCodeResult deviceCode var dict = new Dictionary { [OAuth2Parameter.GrantType] = OAuth2GrantType.DeviceCode, + [OAuth2Parameter.DeviceCode] = deviceCodeResult.DeviceCode, + // TODO: this is out of spec and the server is changing but for now to keep compatible + // across servers as the changes roll out, we're sending the device code both ways. [OAuth2Parameter.Code] = deviceCodeResult.DeviceCode }; return dict;