Unexpected behaviour in deployment

So my app is working locally but now that I’ve deployed (first time I am deploying via Streamlit) it is not working. Specifically, I am stuck on the first page which is the “sign in with Google” button. Clicking the button is supposed to then take me to the next screen where I give permission to Google but this doesn’t happen, instead, after clicking, a quick “running” indication appears in the top right and then nothing happens.

I have already added the deployed domain to the redirect uri on Google Cloud Console (alongside the localhost redirect uri from before) and I have added it in the code below (code below is an excerpt relevant to the first page of the streamlit app).


import streamlit as st
import pycountry
import pandas as pd
import io


#fix limit on number of rows displayed in dataframe in leads found!!!!
#fix error on full name df in leads found.. removed for now???
from ApolloCall import *
from LinkedInData import *
from firestore import *

import google_auth_oauthlib.flow
from googleapiclient.discovery import build
import webbrowser

#go through script and remove redundant code thats not needed

countries = list(pycountry.countries)
country_names = [country.name for country in countries]


redirect_uri = "https://actioai.streamlit.app" #"http://localhost:8501" <to run locally


def auth_flow():
    st.session_state.page = "Google Sign-In"
    
    st.write("Welcome to Actio AI!") #insert dynamic user's name here
    flow = google_auth_oauthlib.flow.Flow.from_client_secrets_file(
        "client_secret.json", # replace with you json credentials from your google auth app
        scopes=["https://www.googleapis.com/auth/userinfo.email", "openid","https://www.googleapis.com/auth/gmail.send"],
        redirect_uri=redirect_uri,
    )

    
    def process_auth(): #amend to only allow certain gmail users?? so we can manage who uses the app and their credit balance etc
            authorization_url, state = flow.authorization_url(
                access_type="offline",
                include_granted_scopes="true",
               # prompt="consent"
            )
            st.session_state.google_auth_code = auth_code #["google_auth_code"] original
            webbrowser.open_new_tab(authorization_url)

    
    st.button("Sign in With Google",on_click=process_auth)
    auth_code = st.experimental_get_query_params().get("code")

    if auth_code: #checks whether code is present in URL (typically the case AFTER user is redirected after authentican. So it basically checks if authentication has taken place.)
  #      try:
            auth_code=auth_code[0]
            flow.fetch_token(code=auth_code)
            credentials = flow.credentials
            st.session_state["credentials"] = credentials
            user_info_service = build(
                serviceName="oauth2",
                version="v2",
                credentials=credentials,
            )
            user_info = user_info_service.userinfo().get().execute()
            user_id = user_info.get('id') #now impleent logic to save this in database, then assign credit score to each action and then subtract from assigned balance
            email = user_info.get('email') #now impleent logic to save this in database
            if "user_saved_to_firestore" not in st.session_state:
                save_user_to_firestore(user_id,email)
                st.session_state.user_saved_to_firestore = True #subsequent calls will not trigger the if statement
            assert user_info.get("email"), "Email not found in infos"
            st.session_state["google_auth_code"] = auth_code
            st.session_state["user_info"] = user_info
            main_content()
            return credentials # can remove this if it dont work all the way down to before def(main)
    
    
def main():
    st.set_page_config(layout="wide")
    
    if "google_auth_code" not in st.session_state  or not st.session_state.google_auth_code:
         auth_flow()
    else:
         main_content()

What am I missing?

Any error/warning messages?

Do you have that json file?