From 1800f9f84513aef9942b87c1c62cf97cf64abc13 Mon Sep 17 00:00:00 2001 From: n3rada <72791564+n3rada@users.noreply.github.com> Date: Wed, 31 Dec 2025 13:32:02 +0100 Subject: [PATCH] Enhance device code documentation with semantics details Added collapsible section explaining device code semantics and updated related content. --- src/graphspy/templates/device_codes.html | 35 ++++++++++++++++++++---- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/src/graphspy/templates/device_codes.html b/src/graphspy/templates/device_codes.html index c01f5c8..8212edc 100644 --- a/src/graphspy/templates/device_codes.html +++ b/src/graphspy/templates/device_codes.html @@ -166,7 +166,7 @@
Device Login URLs

+ +
+
+ Device Code Semantics (Microsoft Entra ID) + +
+
+
+

Microsoft Entra ID implements RFC 8628 with strict single-use semantics.

+
    +
  • While a device code is CREATED / POLLING you may poll /token using grant_type=urn:ietf:params:oauth:grant-type:device_code and receive an access_token (and a refresh_token only if offline_access was requested and allowed).
  • +
  • This polling window is the only time the device code is valid. Once the device code is SUCCESS, it is consumed and further /token calls with that device code return invalid_grant. No additional access tokens and no new refresh tokens will be issued.
  • +
  • After initial token issuance, if you possess a valid refresh token you may use grant_type=refresh_token to obtain new access tokens (and rotated refresh tokens). If a refresh token is rejected (for example AADSTS70043), reauthentication is required and you must generate a new device code.
  • +
+

Key constraints (non-bypassable):

+
    +
  • Device code is single-use; it is not a session or renewable credential.
  • +
  • Refresh token issuance and lifetimes are controlled by tenant policy (Conditional Access, sign-in frequency, security defaults), not by the client.
  • +
  • If Conditional Access or sign-in frequency forces reauth, the only remedy is to request a new device code and have the user sign in again.
  • +
+

One token exchange opportunity per device code. If refresh tokens are not available or are rejected, generate a new device code and reauthenticate.

+

References: RFC 8628 (Device Authorization Grant) ยท Microsoft documentation: Device code flow

+
+
+

Device Code List

@@ -314,10 +339,10 @@

Device Code List

function generateDeviceCodeButton(){ const autoAction = $('input[name="auto_action_radio"]:checked').val(); - + generateDeviceCode( - parseInt($('#api_version input:radio:checked').val()), - client_id_input.value, + parseInt($('#api_version input:radio:checked').val()), + client_id_input.value, resource_input.value, scope_input.value, ngcmfa_checkbox.checked, @@ -336,4 +361,4 @@

Device Code List

$('#device_codes').DataTable().ajax.reload(null, false) }, 5000); -{%endblock content%} \ No newline at end of file +{%endblock content%}