Azure-Samples/ms-identity-python-webapp

different results with debug=True and debug=False

bikeridercz opened this issue · 0 comments

Friends, I'm getting different results depending on debug flag as follows

  • app.run(host='0.0.0.0', port=8080, debug=True) -> everything works fine as you describe in documentation. My identity was successfuly authenticated by EntraID. I got Welcome page and context was populated with name, groups etc values
  • app.run(host='0.0.0.0', port=8080, debug=False) -> I'm getting following errors which is strange ...

Login Failure
configuration_error
Almost there. Did you forget to setup at least these settings? (1) CLIENT_ID, and either (2.1) OIDC_AUTHORITY, or (2.2) AUTHORITY, or (2.3) the B2C_TENANT_NAME and SIGNUPSIGNIN_USER_FLOW pair?`

I'm using app.py as commited to git with those 2 additional lines on the end ...

if name == "main":
app.run(host='0.0.0.0', port=8080, debug=False)`

Then I'm running the application as follows ...

python3 app.py

Console shows following messages

127.0.0.1 - - [24/Apr/2024 08:16:41] "GET / HTTP/1.1" 200 -
Failed to get OIDC config
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/identity/web.py", line 300, in log_out
    e = self._get_oidc_config().get("end_session_endpoint")
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/identity/web.py", line 280, in _get_oidc_config
    return requests.get(f"{a}/.well-known/openid-configuration").json()
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/requests/api.py", line 73, in get
    return request("get", url, params=params, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/requests/api.py", line 59, in request
    return session.request(method=method, url=url, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/requests/sessions.py", line 575, in request
    prep = self.prepare_request(req)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/requests/sessions.py", line 486, in prepare_request
    p.prepare(
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/requests/models.py", line 368, in prepare
    self.prepare_url(url, params)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/requests/models.py", line 439, in prepare_url
    raise MissingSchema(
requests.exceptions.MissingSchema: Invalid URL 'None/.well-known/openid-configuration': No scheme supplied. Perhaps you meant https://None/.well-known/openid-configuration?

Any idea ? Thanks.