Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -43,7 +43,8 @@ else:
|
|
| 43 |
# Create the MSAL instance for acquiring tokens
|
| 44 |
client_instance = get_msal_app()
|
| 45 |
|
| 46 |
-
|
|
|
|
| 47 |
client_instance = get_msal_app()
|
| 48 |
|
| 49 |
st.write("Debug: MSAL App Configuration:")
|
|
@@ -52,11 +53,12 @@ def get_access_token(code):
|
|
| 52 |
st.write(f"Redirect URI: {REDIRECT_URI}")
|
| 53 |
|
| 54 |
try:
|
| 55 |
-
#
|
| 56 |
result = client_instance.acquire_token_by_authorization_code(
|
| 57 |
code=code,
|
| 58 |
scopes=SCOPES,
|
| 59 |
-
redirect_uri=REDIRECT_URI
|
|
|
|
| 60 |
)
|
| 61 |
|
| 62 |
if 'access_token' in result:
|
|
@@ -68,6 +70,7 @@ def get_access_token(code):
|
|
| 68 |
st.error(f"Exception in get_access_token: {str(e)}")
|
| 69 |
raise
|
| 70 |
|
|
|
|
| 71 |
|
| 72 |
def process_query_params():
|
| 73 |
# ⚙️q= Run ArXiv search from query parameters
|
|
|
|
| 43 |
# Create the MSAL instance for acquiring tokens
|
| 44 |
client_instance = get_msal_app()
|
| 45 |
|
| 46 |
+
# Now this function accepts both 'code' and 'code_verifier'
|
| 47 |
+
def get_access_token(code, code_verifier=None):
|
| 48 |
client_instance = get_msal_app()
|
| 49 |
|
| 50 |
st.write("Debug: MSAL App Configuration:")
|
|
|
|
| 53 |
st.write(f"Redirect URI: {REDIRECT_URI}")
|
| 54 |
|
| 55 |
try:
|
| 56 |
+
# Use the 'code_verifier' only if provided (for PKCE flow)
|
| 57 |
result = client_instance.acquire_token_by_authorization_code(
|
| 58 |
code=code,
|
| 59 |
scopes=SCOPES,
|
| 60 |
+
redirect_uri=REDIRECT_URI,
|
| 61 |
+
code_verifier=code_verifier # Ensure this is passed only if PKCE is used
|
| 62 |
)
|
| 63 |
|
| 64 |
if 'access_token' in result:
|
|
|
|
| 70 |
st.error(f"Exception in get_access_token: {str(e)}")
|
| 71 |
raise
|
| 72 |
|
| 73 |
+
|
| 74 |
|
| 75 |
def process_query_params():
|
| 76 |
# ⚙️q= Run ArXiv search from query parameters
|