Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error 400 : redirect_uri_mismatch #10

Open
0ENZO opened this issue Aug 30, 2024 · 0 comments
Open

Error 400 : redirect_uri_mismatch #10

0ENZO opened this issue Aug 30, 2024 · 0 comments

Comments

@0ENZO
Copy link

0ENZO commented Aug 30, 2024

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/"]
  }
}
@0ENZO 0ENZO changed the title Erreur 400 : redirect_uri_mismatch Error 400 : redirect_uri_mismatch Aug 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant