Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[msal-common] Device Code Timeout documentation and sample update #3031

Merged
merged 3 commits into from
Feb 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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