streamlit-google-auth
streamlit-google-auth copied to clipboard
Error 400 : redirect_uri_mismatch
Hi, I am getting an error for no obvious reason. The code is the same as suggested. The credentials have been downloaded directly from gcp interface. Any hint ? Thank you,
Error :
Erreur 400 : redirect_uri_mismatch
Vous ne pouvez pas vous connecter à cette appli, car elle ne respecte pas le règlement OAuth 2.0 de Google.
Si vous êtes le développeur de l'appli, enregistrez l'URI de redirection dans la console Google Cloud.
Détails de la requête : redirect_uri=http://localhost:8501 flowName=GeneralOAuthFlow
Code :
import streamlit as st
from streamlit_google_auth import Authenticate
st.title('Streamlit Google Auth Example')
authenticator = Authenticate(
secret_credentials_path='google_credentials.json',
cookie_name='oauth_cookie',
cookie_key='U0XDoAVmyu88VTDT',
redirect_uri='http://localhost:8501',
)
# Catch the login event
authenticator.check_authentification()
# Create the login button
authenticator.login()
if st.session_state['connected']:
st.image(st.session_state['user_info'].get('picture'))
st.write('Hello, '+ st.session_state['user_info'].get('name'))
st.write('Your email is '+ st.session_state['user_info'].get('email'))
if st.button('Log out'):
authenticator.logout()
google_credentials.json
{
"web":
{
"client_id":".....",
"project_id":"....",
"auth_uri":"https://accounts.google.com/o/oauth2/auth",
"token_uri":"https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs",
"client_secret":"...",
"redirect_uris":["http://127.0.0.1:8501/","http://localhost:8501/","http://localhost:9000/"]
}
}