adding force reapprove to handle case where it is automatically

re-authorizing without user input
This commit is contained in:
adamhaley
2025-08-19 18:05:02 -07:00
parent a949141127
commit 22ad2d805a
2 changed files with 8 additions and 4 deletions
+5 -1
View File
@@ -264,7 +264,7 @@ class DropboxAuthManager:
self.app_secret = None
self.refresh_token = None
def get_oauth_url(self, redirect_uri=None, state=None):
def get_oauth_url(self, redirect_uri=None, state=None, force_reapprove=False):
"""Generate OAuth URL for initial authorization"""
if not self.app_key:
raise ValueError("App key must be set to generate OAuth URL.")
@@ -276,6 +276,10 @@ class DropboxAuthManager:
if state:
url += f"&state={state}"
# Force reapproval to ensure user sees authorization screen
if force_reapprove:
url += "&force_reapprove=true"
return url
+3 -3
View File
@@ -249,7 +249,7 @@ class DropboxSetupNode:
print(f"[DropboxSetup] Detected base URL: {base_url}")
callback_url = f"{base_url}/oauth/dropbox/callback"
print(f"[DropboxSetup] Using callback URL: {callback_url}")
oauth_url = auth_temp.get_oauth_url(redirect_uri=callback_url, state=session_id)
oauth_url = auth_temp.get_oauth_url(redirect_uri=callback_url, state=session_id, force_reapprove=True)
# Set up OAuth session for callback handling
oauth_handler = OAuthCallbackHandler()
@@ -258,7 +258,7 @@ class DropboxSetupNode:
try:
print(f"[DropboxSetup] Setting up automatic OAuth popup...")
# We'll use JavaScript to open a proper popup window
message = f"🚀 Automatic OAuth Ready!\n\n🖱️ Click the link below to open a small popup window for authorization:\n\n🔗 {oauth_url}\n\n✨ After authorization, the popup will close and ComfyUI will refresh automatically!"
message = f"🚀 Automatic OAuth Ready!\n\n🖱️ Click the link below to open a small popup window for authorization:\n\n🔗 {oauth_url}\n\n✨ After authorization, the popup will close and ComfyUI will refresh automatically!\n\n🔍 DEBUG: Session {session_id[:8]}... created at {str(uuid.uuid4())[:8]}"
print(f"[DropboxSetup] Session ID: {session_id}")
print(f"[DropboxSetup] Callback URL: {callback_url}")
print(f"[DropboxSetup] OAuth URL ready for popup: {oauth_url}")
@@ -267,7 +267,7 @@ class DropboxSetupNode:
message = f"🔗 Automatic OAuth Setup:\n\nPlease visit this URL to authorize:\n{oauth_url}\n\nAfter authorization, ComfyUI will refresh automatically!"
else:
# Manual OAuth flow (original behavior)
oauth_url = auth_temp.get_oauth_url()
oauth_url = auth_temp.get_oauth_url(force_reapprove=True)
try:
print(f"[DropboxSetup] Opening browser for manual OAuth flow...")