Open Rob-murphys opened 1 week ago
Hi @Rob-murphys, please follow the instructions here to get an actual client_id
, client_secret
, and tenant_id
- these are parameters that must be generated.
Hi @mkhorasani, sorry I should have said that I have generated them. But it still does not doing anything. I just replaced them in the example I gave as I presumed I should. It share them :)
That is odd, can you please check the console to see if there are any errors?
I get no errors, just outputs something along the lines of “No accept token generated”.
Can you please make sure that your redirect URL is correctly configured in your Azure portal where you generated the IDs.
Can you also try with Google OAuth2 to see if there is a problem there too?
My redirect URL is http://localhost:8501
both in my config.yml
and in the Azure portal.
I am not sure what I changed this morning but I now get an error:
File "C:\Users\some-name\AppData\Local\miniconda3\envs\usage_app\Lib\site-packages\streamlit\runtime\scriptrunner\exec_code.py", line 88, in exec_func_with_error_handling
result = func()
^^^^^^
File "C:\Users\some-name\AppData\Local\miniconda3\envs\usage_app\Lib\site-packages\streamlit\runtime\scriptrunner\script_runner.py", line 579, in code_to_exec
exec(code, module.__dict__)
File "C:\Users\some\path\usage_app\src\usage_app.py", line 31, in <module>
authenticator.experimental_guest_login('Login with Microsoft', provider='microsoft',
File "C:\Users\some-name\AppData\Local\miniconda3\envs\usage_app\Lib\site-packages\streamlit_authenticator\views\authentication_view.py", line 222, in experimental_guest_login
self.authentication_controller.guest_login(cookie_controller=\
File "C:\Users\some-name\AppData\Local\miniconda3\envs\usage_app\Lib\site-packages\streamlit_authenticator\controllers\authentication_controller.py", line 167, in guest_login
return self.authentication_model.guest_login(cookie_controller=cookie_controller,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\some-name\AppData\Local\miniconda3\envs\usage_app\Lib\site-packages\streamlit_authenticator\models\authentication_model.py", line 292, in guest_login
if result['email'] not in self.credentials['usernames']:
~~~~~~^^^^^^^^^
KeyError: 'email'
My redirect URL is
http://localhost:8501
both in myconfig.yml
and in teh Azure portal.I am not sure what I changed this morning but I now get an error:
File "C:\Users\some-name\AppData\Local\miniconda3\envs\usage_app\Lib\site-packages\streamlit\runtime\scriptrunner\exec_code.py", line 88, in exec_func_with_error_handling result = func() ^^^^^^ File "C:\Users\some-name\AppData\Local\miniconda3\envs\usage_app\Lib\site-packages\streamlit\runtime\scriptrunner\script_runner.py", line 579, in code_to_exec exec(code, module.__dict__) File "C:\Users\some\path\usage_app\src\usage_app.py", line 31, in <module> authenticator.experimental_guest_login('Login with Microsoft', provider='microsoft', File "C:\Users\some-name\AppData\Local\miniconda3\envs\usage_app\Lib\site-packages\streamlit_authenticator\views\authentication_view.py", line 222, in experimental_guest_login self.authentication_controller.guest_login(cookie_controller=\ File "C:\Users\some-name\AppData\Local\miniconda3\envs\usage_app\Lib\site-packages\streamlit_authenticator\controllers\authentication_controller.py", line 167, in guest_login return self.authentication_model.guest_login(cookie_controller=cookie_controller, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\some-name\AppData\Local\miniconda3\envs\usage_app\Lib\site-packages\streamlit_authenticator\models\authentication_model.py", line 292, in guest_login if result['email'] not in self.credentials['usernames']: ~~~~~~^^^^^^^^^ KeyError: 'email'
This is very difficult to diagnose. If it is not a problem can you privately send your OAuth2 configuration parameters to my email - khorasani.mohammad@gmail.com, and I will try to diagnose it locally. Thanks.
@mkhorasani I will do that. Including or excluding the client secret?
@mkhorasani I will do that. Including or excluding the client secret?
Everything please.
I'm getting this same error. On further investigation, it's because my result dict doesn't contain the key 'email', but instead 'mail'. To be exact, the result dict looks like the following:
{ "displayName": "Ben Davis", "officeLocation": "WHQ Building C", "mail": "fake_email@gmail.com" }
The error should resolve if you add something along the lines of result['email'] = result.get('email', result.get('mail'))
above line 292 in streamlit_authenticator\models\authentication_model.py
I'm getting this same error. On further investigation, it's because my result dict doesn't contain the key 'email', but instead 'mail'. To be exact, the result dict looks like the following:
{ "displayName": "Ben Davis", "officeLocation": "WHQ Building C", "mail": "fake_email@gmail.com" }
The error should resolve if you add something along the lines ofresult['email'] = result.get('email', result['mail'])
above line 292 in streamlit_authenticator\models\authentication_model.pyYou're a life saver! I will fix this in the next release.
I am trying to use the newly relrease Oauth2 functionality but when I pretty the "Log in with microsoft" button I just get redirected to the app. My
config.yml looks
like this:In the code for the app I have this:
But as said above, when I pretty the button I am just redirected back to the app. I presume I am doing something wrong but I just dont know what!