forked from hunkim/streamlit-google-oauth
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
32 lines (28 loc) · 917 Bytes
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import streamlit as st
import os
from dotenv import load_dotenv
import streamlit_google_oauth as oauth
load_dotenv()
client_id = os.environ["GOOGLE_CLIENT_ID"]
client_secret = os.environ["GOOGLE_CLIENT_SECRET"]
redirect_uri = os.environ["GOOGLE_REDIRECT_URI"]
if __name__ == "__main__":
app_name = '''
Streamlit Google Authentication Demo
'''
app_desc = '''
A streamlit application that authenticates users by <strong>Google Oauth</strong>.
The user must have a google account to log in into the application.
'''
login_info = oauth.login(
client_id=client_id,
client_secret=client_secret,
redirect_uri=redirect_uri,
app_name=app_name,
app_desc=app_desc,
logout_button_text="Logout",
)
if login_info:
user_id, user_email = login_info
st.write(f"Welcome {user_email}")
# streamlit run app.py --server.port 8080