File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change 5151
5252if not result :
5353 logging .info ("No suitable token exists in cache. Let's get a new one from AAD." )
54+
5455 flow = app .initiate_device_flow (scopes = config ["scope" ])
56+ if "user_code" not in flow :
57+ raise ValueError (
58+ "Fail to create device flow. Err: %s" % json .dumps (flow , indent = 4 ))
59+
5560 print (flow ["message" ])
61+ sys .stdout .flush () # Some terminal needs this to ensure the message is shown
62+
5663 # Ideally you should wait here, in order to save some unnecessary polling
57- # input("Press Enter after you successfully login from another device...")
64+ # input("Press Enter after signing in from another device to proceed, CTRL+C to abort.")
65+
5866 result = app .acquire_token_by_device_flow (flow ) # By default it will block
5967 # You can follow this instruction to shorten the block time
6068 # https://msal-python.readthedocs.io/en/latest/#msal.PublicClientApplication.acquire_token_by_device_flow
You can’t perform that action at this time.
0 commit comments