Spaces:
Running
Running
Update google_function.py
Browse files- google_function.py +3 -3
google_function.py
CHANGED
|
@@ -147,10 +147,9 @@ def connetti_google():
|
|
| 147 |
st.write("Welcome to My App!")
|
| 148 |
auth_code = st.query_params.get("code")
|
| 149 |
flow = InstalledAppFlow.from_client_secrets_file("./credentials.json", SCOPES, redirect_uri='https://matteoscript-streamlitchat-new.hf.space')
|
| 150 |
-
print(flow)
|
| 151 |
if auth_code:
|
| 152 |
flow.fetch_token(code=auth_code)
|
| 153 |
-
|
| 154 |
st.write("Login Done")
|
| 155 |
user_info_service = build(
|
| 156 |
serviceName="oauth2",
|
|
@@ -164,7 +163,8 @@ def connetti_google():
|
|
| 164 |
else:
|
| 165 |
authorization_url, state = flow.authorization_url(include_granted_scopes="true",)
|
| 166 |
print(authorization_url)
|
| 167 |
-
|
|
|
|
| 168 |
|
| 169 |
def connetti_google_2():
|
| 170 |
load_dotenv()
|
|
|
|
| 147 |
st.write("Welcome to My App!")
|
| 148 |
auth_code = st.query_params.get("code")
|
| 149 |
flow = InstalledAppFlow.from_client_secrets_file("./credentials.json", SCOPES, redirect_uri='https://matteoscript-streamlitchat-new.hf.space')
|
|
|
|
| 150 |
if auth_code:
|
| 151 |
flow.fetch_token(code=auth_code)
|
| 152 |
+
creds = flow.credentials
|
| 153 |
st.write("Login Done")
|
| 154 |
user_info_service = build(
|
| 155 |
serviceName="oauth2",
|
|
|
|
| 163 |
else:
|
| 164 |
authorization_url, state = flow.authorization_url(include_granted_scopes="true",)
|
| 165 |
print(authorization_url)
|
| 166 |
+
st.markdown(f'<a href="{authorization_url}">Click here to sign in with Google</a>', unsafe_allow_html=True)
|
| 167 |
+
return creds
|
| 168 |
|
| 169 |
def connetti_google_2():
|
| 170 |
load_dotenv()
|