404 Error from Google OAuth Redirect When Running Streamlit App Online

Hello, I am a student currently working on building an app. In this app, users are redirected to Google login authentication. After authentication, they are prompted to give consent for specific information. Once consent is granted, the user is redirected back to the Streamlit page.

The issue I’m encountering is that the code works perfectly on localhost, but when running it on the web version, I receive a 404 Error from Google. I suspect the problem might be related to the JavaScript Origins settings in the OAuth 2.0 credentials I’ve configured, specifically, the URL of the Streamlit app. However, I’m struggling to rectify this issue.

I’m not entirely sure whether this error stems from OAuth or Streamlit, which is why I’m posting it here for assistance.

PS: I’m uncertain about whether this error is related to OAuth or Streamlit, so I’m seeking help in this forum.

It may also be related to your code.

I apologize I missed out on providing more information.
I am using gcsa in my code (google calendar api), plan to edit the user’s google calendar.
(following is a test code where I am trying to print the events from the calendar.)

cred_path  = os.path.join(os.path.dirname(os.path.abspath(__file__)), "credentials2.json")
tok_path  = os.path.join(os.path.dirname(os.path.abspath(__file__)), "token.pickle")

st.write("Fetching Events...")
calendar = GoogleCalendar(credentials_path=cred_path, token_path=tok_path, save_token=True, read_only=False)
  
st.write("Succesfully authenticated")

for event in calendar:
        start = event.start
summary = event.summary
st.write(f"Start: {start}, Summary: {summary}")

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.