awacke1 commited on
Commit
5927e43
ยท
verified ยท
1 Parent(s): d352033

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -23
app.py CHANGED
@@ -171,30 +171,30 @@ def main():
171
  # ๐Ÿ•ต๏ธโ€โ™‚๏ธ Check for authorization code in query parameters
172
  query_params = st.query_params
173
  query = (query_params.get('code'))
174
- if len(query) > 1:
 
 
 
 
 
175
 
176
- st.write('Parsing query ' + query_params )
177
- if 'code' in query_params:
178
- #code = query_params['code'][0]
179
- code = query_params.get('code')
180
-
181
- st.write('๐Ÿ”‘Access Code Obtained from MS Graph Redirect๐Ÿ”‘!:' + code)
182
-
183
- st.write('๐Ÿ”‘ Acquiring access token from redirect URL for code parameter.')
184
- access_token = get_access_token(code)
185
-
186
- st.session_state['access_token'] = access_token # ๐Ÿ”‘ Save it for later
187
-
188
- st.rerun() # Reload the app to clear the code from URL
189
- else:
190
- # ๐Ÿ“ข Prompt user to log in
191
- client_instance = get_msal_app()
192
- authorization_url = client_instance.get_authorization_request_url(
193
- scopes=SCOPES,
194
- redirect_uri=REDIRECT_URI
195
- )
196
- st.write('๐Ÿ‘‹ Please [click here]({}) to log in and authorize the app.'.format(authorization_url))
197
- st.stop()
198
 
199
 
200
  else:
 
171
  # ๐Ÿ•ต๏ธโ€โ™‚๏ธ Check for authorization code in query parameters
172
  query_params = st.query_params
173
  query = (query_params.get('code'))
174
+ #if len(query) > 1:
175
+
176
+ st.write('Parsing query ' + query_params )
177
+ if 'code' in query_params:
178
+ #code = query_params['code'][0]
179
+ code = query_params.get('code')
180
 
181
+ st.write('๐Ÿ”‘Access Code Obtained from MS Graph Redirect๐Ÿ”‘!:' + code)
182
+
183
+ st.write('๐Ÿ”‘ Acquiring access token from redirect URL for code parameter.')
184
+ access_token = get_access_token(code)
185
+
186
+ st.session_state['access_token'] = access_token # ๐Ÿ”‘ Save it for later
187
+
188
+ st.rerun() # Reload the app to clear the code from URL
189
+ else:
190
+ # ๐Ÿ“ข Prompt user to log in
191
+ client_instance = get_msal_app()
192
+ authorization_url = client_instance.get_authorization_request_url(
193
+ scopes=SCOPES,
194
+ redirect_uri=REDIRECT_URI
195
+ )
196
+ st.write('๐Ÿ‘‹ Please [click here]({}) to log in and authorize the app.'.format(authorization_url))
197
+ st.stop()
 
 
 
 
 
198
 
199
 
200
  else: