Skip to content

Commit 7fef8f9

Browse files
committed
Document the possible failure in Device Flow
1 parent ad28a6a commit 7fef8f9

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

msal/application.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,9 @@ def initiate_device_flow(self, scopes=None, **kwargs):
330330
:param list[str] scopes:
331331
Scopes requested to access a protected API (a resource).
332332
:return: A dict representing a newly created Device Flow object.
333+
334+
- A successful response would contain "user_code" key, among others
335+
- an error response would contain some other readable key/value pairs.
333336
"""
334337
return self.client.initiate_device_flow(
335338
scope=decorate_scope(scopes or [], self.client_id),

tests/test_application.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ def test_device_flow(self):
109109
self.app = PublicClientApplication(
110110
CONFIG["client_id"], authority=CONFIG["authority"])
111111
flow = self.app.initiate_device_flow(scopes=CONFIG.get("scope"))
112+
assert "user_code" in flow, str(flow) # Provision or policy might block DF
112113
logging.warn(flow["message"])
113114

114115
duration = 30

0 commit comments

Comments
 (0)