Skip to content

Add interval and expires_in support to Device Code Flow - #7

Closed
adamLiveware with Copilot wants to merge 5 commits into
device-code-flow-bulk-login-15901970604348367866from
copilot/sub-pr-1-again
Closed

Add interval and expires_in support to Device Code Flow#7
adamLiveware with Copilot wants to merge 5 commits into
device-code-flow-bulk-login-15901970604348367866from
copilot/sub-pr-1-again

Conversation

Copilot AI commented Jan 6, 2026

Copy link
Copy Markdown

The OAuth 2.0 Device Authorization Grant response includes interval (minimum polling interval) and expires_in (device code lifetime) fields that were being ignored, causing hardcoded 5-second polling and no timeout handling.

Changes

Backend (D4PDeviceAuthHelper.codeunit.al)

  • Extract interval and expires_in from device code response
  • Validate values are positive; default to 5s and 900s respectively
  • Return values via new output parameters on RequestDeviceCode

Frontend (D4PBulkLoginControl)

  • Accept interval/expires_in parameters in StartLoginProcess
  • Use server-specified interval instead of hardcoded 5000ms
  • Add timeout that stops polling and notifies user when device code expires

Example flow

// Before: hardcoded 5s polling, no timeout
setInterval(poll, 5000);

// After: server-specified interval with timeout
var intervalMs = (intervalSeconds || 5) * 1000;
setInterval(poll, intervalMs);
setTimeout(handleExpiry, expiresInSeconds * 1000);

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 4 commits January 6, 2026 10:02
Co-authored-by: adamLiveware <25444589+adamLiveware@users.noreply.github.com>
…s message

Co-authored-by: adamLiveware <25444589+adamLiveware@users.noreply.github.com>
Co-authored-by: adamLiveware <25444589+adamLiveware@users.noreply.github.com>
Co-authored-by: adamLiveware <25444589+adamLiveware@users.noreply.github.com>
Copilot AI changed the title [WIP] WIP address feedback on device code flow auth Add interval and expires_in support to Device Code Flow Jan 6, 2026
Copilot AI requested a review from adamLiveware January 6, 2026 10:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants