get authorization code fix
Browse files- utils/callbackmanager.py +1 -0
- utils/meldrx.py +2 -1
utils/callbackmanager.py
CHANGED
@@ -8,6 +8,7 @@ from huggingface_hub import InferenceClient # Import InferenceClient
|
|
8 |
from urllib.parse import urlparse, parse_qs # Import URL parsing utilities
|
9 |
from utils.meldrx import MeldRxAPI # Import the MeldRxAPI class
|
10 |
# ... (CallbackManager, display_form, generate_pdf_from_form, generate_pdf_from_meldrx, generate_discharge_paper_one_click, client initialization remain the same) ...
|
|
|
11 |
class CallbackManager:
|
12 |
def __init__(self, redirect_uri: str, client_secret: str = None):
|
13 |
client_id = os.getenv("APPID")
|
|
|
8 |
from urllib.parse import urlparse, parse_qs # Import URL parsing utilities
|
9 |
from utils.meldrx import MeldRxAPI # Import the MeldRxAPI class
|
10 |
# ... (CallbackManager, display_form, generate_pdf_from_form, generate_pdf_from_meldrx, generate_discharge_paper_one_click, client initialization remain the same) ...
|
11 |
+
|
12 |
class CallbackManager:
|
13 |
def __init__(self, redirect_uri: str, client_secret: str = None):
|
14 |
client_id = os.getenv("APPID")
|
utils/meldrx.py
CHANGED
@@ -4,6 +4,7 @@ import base64
|
|
4 |
import hashlib
|
5 |
import secrets
|
6 |
from typing import Optional, Dict, Any
|
|
|
7 |
|
8 |
class MeldRxAPI:
|
9 |
def __init__(self, client_id: str, client_secret: str, workspace_id: str, redirect_uri: str):
|
@@ -84,7 +85,7 @@ class MeldRxAPI:
|
|
84 |
"code_challenge": code_challenge,
|
85 |
"code_challenge_method": "S256"
|
86 |
}
|
87 |
-
query_string =
|
88 |
return f"{self.authorize_url}?{query_string}"
|
89 |
|
90 |
def authenticate_with_code(self, auth_code: str) -> bool:
|
|
|
4 |
import hashlib
|
5 |
import secrets
|
6 |
from typing import Optional, Dict, Any
|
7 |
+
from urllib.parse import urlencode
|
8 |
|
9 |
class MeldRxAPI:
|
10 |
def __init__(self, client_id: str, client_secret: str, workspace_id: str, redirect_uri: str):
|
|
|
85 |
"code_challenge": code_challenge,
|
86 |
"code_challenge_method": "S256"
|
87 |
}
|
88 |
+
query_string = urlencode(params, safe='/*') # 'safe' preserves / and * in scope
|
89 |
return f"{self.authorize_url}?{query_string}"
|
90 |
|
91 |
def authenticate_with_code(self, auth_code: str) -> bool:
|