Google Sign in

Hello Everyone!!
Hope that all are doing well. I am extremely new at streamlit.
Now I am trying to google authenticate. That means I have a button, whenever I click this button, It will require google authentication, which means the user will give the proper email address and password.

This is my ( file’s code:

import streamlit as st

from auth import *

st.title(“Google Login”)

st.button(“Sign in with Google”)



This is my ( file:

import os

from numpy import void

import streamlit as st

import asyncio

OAuth2 - HTTPX OAuth

from import GoogleOAuth2

from dotenv import load_dotenv


CLIENT_ID = os.environ[“”]

CLIENT_SECRET = os.environ[“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”]

REDIRECT_URI = os.environ[‘http://localhost:8501/’]

async def get_authorization_url(client: GoogleOAuth2, redirect_uri: str):

authorization_url = await client.get_authorization_url(redirect_uri, scope=[“profile”, “email”])

return authorization_url

def get_login_str():
client: GoogleOAuth2 = GoogleOAuth2(CLIENT_ID, CLIENT_SECRET)
authorization_url =
get_authorization_url(client, REDIRECT_URI))
return f’‘’ < a target = “_self” href = “{authorization_url}” > Google login < /a > ‘’’

This is my (.env) File



REDIRECT_URI = “http://localhost:8501

Output is like

Hi there,

Thanks for sharing your question with the community! Check out our guidelines on how to post an effective question here – in particular, please format your code properly so the community can read it and make suggestions

Caroline :balloon: