This sample demonstrates a Python Django web application calling a Python Flask web API that then calls the Azure Management API subscriptions endpoint. The web application and API are secured using Azure Active Directory.
- [ ] bug report -> please search issues before submitting
- [ ] feature request
- [ X] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)
Minimal steps to reproduce
In MacOS, cannot perform the following step 2 item
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope Process -Force
. .\venv\Scripts\Activate.ps1
Even installation of pwershell does not solve the issue
PS /Users/name/dev/ms-identity-python-on-behalf-of/DjangoUI> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope Process -Force
Set-ExecutionPolicy: Operation is not supported on this platform.
getting the following
System check identified no issues (0 silenced).
December 13, 2021 - 03:15:03
Django version 3.1.14, using settings 'UI.development_settings'
Starting development server at http://localhost:8000/
Quit the server with CONTROL-C.
[13/Dec/2021 03:15:08] "GET / HTTP/1.1" 302 0
Creating new confidential client
[13/Dec/2021 03:15:08] "GET /account/login HTTP/1.1" 302 0
[13/Dec/2021 03:16:46] "GET /account/callback?code=0.ATcARDA-RC3oCkGLCldJhyIkHUUaCtcb7M5IqpiAf2HdZ7o3AIg.AQABAAIAAAD--DLA3VO7QrddgJg7Wevr3mdgt7mWkwMxexpRdPjJ2L3wg9A3GlU8kV1TYi2WaVBppZOHNkK1nqmwLonEACXJ9AMJadT4TqmKYHAAlPSjpl5miFqhylSwDPr_fdzC_cv54ACxSyq2wgBuiePyvohPoMbOoOyMxeo8yH3q5tJzEycC8h-r1R9yXrsqPvsq0qnY_tFXEuUlJhXT_x91gvzqPQyvaexdHUS_j1RPzO6qIlfoZ1D-LzVG2m5LvOoFGCcUJkEQ3d0gNb_rAZePnYGjvRyABgiIiqsoGSS61vfKkdQLQiHIReQEMvC2Mfd_rkTCCLHzJVzvyP26-j0ErcMJHRgMKM00cPJz1m82IV8s8sPFyRZa2vOXr6CiimZN4DaCSQjFa3H9O2DZzM2QVjsGdROFZ8wFw5Xl3s9V5Etyq8-6TBY0vXgL65n-Y5JzdUTrwhI3X1I_s9MTNqNhEseNVQ24fOnJgHg6pZXDpUGhX6vrt3XobDRhACsEZjlrgbYhnUvwlyNE73fI4JUeZSX-gJ-oMpuNnUzvHhQeTFkL96uTNZVIXQQxPG_MvBiXQvwSJFTmTmkIHHaPgHvFj0VmrLcjtVXUPuZYp9qGAixGHBIQyPcZuwZ5pam-ljz_YdifBUNxTjsMaEU_IVhhEhpwxBJocbt3fSIui37PA_fgvMhTmhChD01xnXVidUQ3mO-ZAh2KMWTlDVIzi1CG6e9d2a2qXaC2zXRI3vW0BfXWwkAFuqfOWNWvuFa08GH95tGv9BUIcqEeHwosVm6iXOwdJsNl75a7Q8ZtPxx3u346bLQVOtS3YhLQgrQ5fHB1132qUY8cH1NOThQ4oSo02cab5rkv1qOasQcn541yZIoeO88sCHPEy15r3rjHU831glu15imgm-qyU2-Z0TrrsmcZbq4Iri_Kch6nXeXMgHfeEg7iy74AYTuwkBSsSOUIjuiwKZibGZgLxuSYtvO_6XbbftjiIif4Md7UvjL4NpvoGLsNvI2oALDdDpZnDK5dJApHSVHU2ywcLD14zqK1-GshIAA&state=vLZBqUejftlkFhxD&session_state=58201279-71d5-427e-8374-c1825f18ccb7 HTTP/1.1" 302 0
/Users/user/.pyenv/versions/3.9.2/lib/python3.9/site-packages/msal/application.py:771: UserWarning: We haven't decided how/if this method will accept authority parameter
warnings.warn("We haven't decided how/if this method will accept authority parameter")
Any log messages given by the failure
Internal Server Error: /
Traceback (most recent call last):
File "/Users/user/.pyenv/versions/3.9.2/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner
response = get_response(request)
File "/Users/user/.pyenv/versions/3.9.2/lib/python3.9/site-packages/django/core/handlers/base.py", line 181, in _get_response
response = wrapped_callback(request, *callback_args, callback_kwargs)
File "/Users/user/.pyenv/versions/3.9.2/lib/python3.9/site-packages/django/views/generic/base.py", line 70, in view
return self.dispatch(request, *args, *kwargs)
File "/Users/user/.pyenv/versions/3.9.2/lib/python3.9/site-packages/django/views/generic/base.py", line 98, in dispatch
return handler(request, args, kwargs)
File "/Users/user/dev/ms-identity-python-on-behalf-of/DjangoUI/AzureManagement/views.py", line 28, in get
if "error" in token_response:
TypeError: argument of type 'NoneType' is not iterable
This issue is for a: (mark with an
x
)Minimal steps to reproduce
getting the following
System check identified no issues (0 silenced). December 13, 2021 - 03:15:03 Django version 3.1.14, using settings 'UI.development_settings' Starting development server at http://localhost:8000/ Quit the server with CONTROL-C. [13/Dec/2021 03:15:08] "GET / HTTP/1.1" 302 0 Creating new confidential client [13/Dec/2021 03:15:08] "GET /account/login HTTP/1.1" 302 0 [13/Dec/2021 03:16:46] "GET /account/callback?code=0.ATcARDA-RC3oCkGLCldJhyIkHUUaCtcb7M5IqpiAf2HdZ7o3AIg.AQABAAIAAAD--DLA3VO7QrddgJg7Wevr3mdgt7mWkwMxexpRdPjJ2L3wg9A3GlU8kV1TYi2WaVBppZOHNkK1nqmwLonEACXJ9AMJadT4TqmKYHAAlPSjpl5miFqhylSwDPr_fdzC_cv54ACxSyq2wgBuiePyvohPoMbOoOyMxeo8yH3q5tJzEycC8h-r1R9yXrsqPvsq0qnY_tFXEuUlJhXT_x91gvzqPQyvaexdHUS_j1RPzO6qIlfoZ1D-LzVG2m5LvOoFGCcUJkEQ3d0gNb_rAZePnYGjvRyABgiIiqsoGSS61vfKkdQLQiHIReQEMvC2Mfd_rkTCCLHzJVzvyP26-j0ErcMJHRgMKM00cPJz1m82IV8s8sPFyRZa2vOXr6CiimZN4DaCSQjFa3H9O2DZzM2QVjsGdROFZ8wFw5Xl3s9V5Etyq8-6TBY0vXgL65n-Y5JzdUTrwhI3X1I_s9MTNqNhEseNVQ24fOnJgHg6pZXDpUGhX6vrt3XobDRhACsEZjlrgbYhnUvwlyNE73fI4JUeZSX-gJ-oMpuNnUzvHhQeTFkL96uTNZVIXQQxPG_MvBiXQvwSJFTmTmkIHHaPgHvFj0VmrLcjtVXUPuZYp9qGAixGHBIQyPcZuwZ5pam-ljz_YdifBUNxTjsMaEU_IVhhEhpwxBJocbt3fSIui37PA_fgvMhTmhChD01xnXVidUQ3mO-ZAh2KMWTlDVIzi1CG6e9d2a2qXaC2zXRI3vW0BfXWwkAFuqfOWNWvuFa08GH95tGv9BUIcqEeHwosVm6iXOwdJsNl75a7Q8ZtPxx3u346bLQVOtS3YhLQgrQ5fHB1132qUY8cH1NOThQ4oSo02cab5rkv1qOasQcn541yZIoeO88sCHPEy15r3rjHU831glu15imgm-qyU2-Z0TrrsmcZbq4Iri_Kch6nXeXMgHfeEg7iy74AYTuwkBSsSOUIjuiwKZibGZgLxuSYtvO_6XbbftjiIif4Md7UvjL4NpvoGLsNvI2oALDdDpZnDK5dJApHSVHU2ywcLD14zqK1-GshIAA&state=vLZBqUejftlkFhxD&session_state=58201279-71d5-427e-8374-c1825f18ccb7 HTTP/1.1" 302 0 /Users/user/.pyenv/versions/3.9.2/lib/python3.9/site-packages/msal/application.py:771: UserWarning: We haven't decided how/if this method will accept authority parameter warnings.warn("We haven't decided how/if this method will accept authority parameter")
Any log messages given by the failure
Expected/desired behavior
OS and Version?
Versions
Mention any other details that might be useful