Skip to content

Commit

Permalink
Merge pull request #3031 from AzureAD/node-timeout-update
Browse files Browse the repository at this point in the history
[msal-common] Device Code Timeout documentation and sample update
  • Loading branch information
sameerag authored Feb 17, 2021
2 parents c9da47e + c4e29ca commit 6ce0f54
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Clarify Device Code Timeout units (#3031)",
"packageName": "@azure/msal-common",
"email": "hemoral@microsoft.com",
"dependentChangeType": "patch"
}
2 changes: 1 addition & 1 deletion lib/msal-common/src/request/CommonDeviceCodeRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down

0 comments on commit 6ce0f54

Please sign in to comment.