Spaces:
				
			
			
	
			
			
		Paused
		
	
	
	
			
			
	
	
	
	
		
		
		Paused
		
	| <html> | |
| <head> | |
| <title>Completing Authentication...</title> | |
| <style> | |
| body { | |
| font-family: Arial, sans-serif; | |
| display: flex; | |
| justify-content: center; | |
| align-items: center; | |
| height: 100vh; | |
| margin: 0; | |
| background-color: #f5f5f5; | |
| } | |
| .container { | |
| text-align: center; | |
| padding: 20px; | |
| background: white; | |
| border-radius: 8px; | |
| box-shadow: 0 2px 4px rgba(0,0,0,0.1); | |
| } | |
| .spinner { | |
| border: 3px solid #f3f3f3; | |
| border-top: 3px solid #3498db; | |
| border-radius: 50%; | |
| width: 40px; | |
| height: 40px; | |
| animation: spin 1s linear infinite; | |
| margin: 20px auto; | |
| } | |
| @keyframes spin { | |
| 0% { transform: rotate(0deg); } | |
| 100% { transform: rotate(360deg); } | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <div class="container"> | |
| <h2>Completing authentication...</h2> | |
| <div class="spinner"></div> | |
| <p id="status">Please wait...</p> | |
| </div> | |
| <script> | |
| function updateStatus(message) { | |
| document.getElementById('status').textContent = message; | |
| } | |
| try { | |
| // Extract token from URL | |
| let token = null; | |
| // For Google and Microsoft (token in hash) | |
| if (window.location.hash) { | |
| const hashParams = new URLSearchParams(window.location.hash.substring(1)); | |
| token = hashParams.get('access_token'); | |
| } | |
| // For Slack (token might be in query params) | |
| if (!token && window.location.search) { | |
| const queryParams = new URLSearchParams(window.location.search); | |
| token = queryParams.get('access_token'); | |
| // Slack might return a code instead of token | |
| const code = queryParams.get('code'); | |
| if (code && !token) { | |
| updateStatus('Slack requires additional setup. Please implement code exchange.'); | |
| setTimeout(() => { | |
| if (window.opener) { | |
| window.opener.postMessage({ type: 'auth-failed', error: 'Slack code exchange not implemented' }, '*'); | |
| window.close(); | |
| } | |
| }, 3000); | |
| } | |
| } | |
| if (token) { | |
| updateStatus('Authentication successful! Closing window...'); | |
| // Send token back to parent window | |
| if (window.opener) { | |
| window.opener.postMessage({ | |
| type: 'auth-success', | |
| token: token | |
| }, window.location.origin); | |
| // Close window after a short delay | |
| setTimeout(() => window.close(), 1000); | |
| } else { | |
| updateStatus('Unable to communicate with main window. Please close this window manually.'); | |
| } | |
| } else { | |
| updateStatus('Authentication failed. No token received.'); | |
| setTimeout(() => { | |
| if (window.opener) { | |
| window.opener.postMessage({ type: 'auth-failed', error: 'No token received' }, '*'); | |
| window.close(); | |
| } | |
| }, 3000); | |
| } | |
| } catch (error) { | |
| updateStatus('An error occurred: ' + error.message); | |
| console.error('Auth error:', error); | |
| } | |
| </script> | |
| </body> | |
| </html> |