From 0d2b82621064fef442596a7fe428c3b1e9a54e74 Mon Sep 17 00:00:00 2001 From: HectorMg Date: Tue, 16 Feb 2021 14:48:03 -0800 Subject: [PATCH 1/2] Add clarification of time unit to Device code timeout configuration and increase the default timeout in the Device code samples to 20s --- lib/msal-common/src/request/CommonDeviceCodeRequest.ts | 2 +- .../msal-node-samples/standalone-samples/device-code/index.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/msal-common/src/request/CommonDeviceCodeRequest.ts b/lib/msal-common/src/request/CommonDeviceCodeRequest.ts index 0aa4537e26..60085e3f70 100644 --- a/lib/msal-common/src/request/CommonDeviceCodeRequest.ts +++ b/lib/msal-common/src/request/CommonDeviceCodeRequest.ts @@ -15,7 +15,7 @@ import { BaseAuthRequest } from "./BaseAuthRequest"; * - cancel - Boolean to cancel polling of device code endpoint. While the user authenticates on a separate device, MSAL polls the the token endpoint of security token service for the interval specified in the device code response (usually 15 minutes). To stop polling and cancel the request, set cancel=true. * - resourceRequestMethod - HTTP Request type used to request data from the resource (i.e. "GET", "POST", etc.). Used for proof-of-possession flows. * - resourceRequestUri - URI that token will be used for. Used for proof-of-possession flows. - * - timeout - Period in which the user explicitly configures for the polling of the device code endpoint. At the end of this period; assuming the device code has not expired yet; the device code polling is stopped and the request cancelled. The device code expiration window will always take precedence over this set period. + * - timeout - Timeout period in seconds which the user explicitly configures for the polling of the device code endpoint. At the end of this period; assuming the device code has not expired yet; the device code polling is stopped and the request cancelled. The device code expiration window will always take precedence over this set period. */ export type CommonDeviceCodeRequest = BaseAuthRequest & { deviceCodeCallback: (response: DeviceCodeResponse) => void; diff --git a/samples/msal-node-samples/standalone-samples/device-code/index.js b/samples/msal-node-samples/standalone-samples/device-code/index.js index 82672b30a5..08fe96a937 100644 --- a/samples/msal-node-samples/standalone-samples/device-code/index.js +++ b/samples/msal-node-samples/standalone-samples/device-code/index.js @@ -17,7 +17,7 @@ const pca = new msal.PublicClientApplication(msalConfig); const deviceCodeRequest = { deviceCodeCallback: (response) => (console.log(response.message)), scopes: ["user.read"], - timeout: 5, + timeout: 20, }; pca.acquireTokenByDeviceCode(deviceCodeRequest).then((response) => { From af97180664ec257f2fdb6f04ab0921affeb9a8f3 Mon Sep 17 00:00:00 2001 From: HectorMg Date: Tue, 16 Feb 2021 15:13:14 -0800 Subject: [PATCH 2/2] Change files --- ...e-msal-common-164c2c31-d950-4d43-9601-a63101917787.json | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 change/@azure-msal-common-164c2c31-d950-4d43-9601-a63101917787.json diff --git a/change/@azure-msal-common-164c2c31-d950-4d43-9601-a63101917787.json b/change/@azure-msal-common-164c2c31-d950-4d43-9601-a63101917787.json new file mode 100644 index 0000000000..327f83b779 --- /dev/null +++ b/change/@azure-msal-common-164c2c31-d950-4d43-9601-a63101917787.json @@ -0,0 +1,7 @@ +{ + "type": "patch", + "comment": "Clarify Device Code Timeout units (#3031)", + "packageName": "@azure/msal-common", + "email": "hemoral@microsoft.com", + "dependentChangeType": "patch" +}