diff --git a/src/components/oauth/OAuthProviderButton.tsx b/src/components/oauth/OAuthProviderButton.tsx index 4f9295afc..d98583674 100644 --- a/src/components/oauth/OAuthProviderButton.tsx +++ b/src/components/oauth/OAuthProviderButton.tsx @@ -2,6 +2,7 @@ import { useState } from 'react'; import type { OAuthProviderConfig } from '../../types/oauth'; import { openUrl } from '../../utils/openUrl'; import { isTauri } from '../../utils/tauriCommands'; +import { IS_DEV } from '../../utils/config'; interface OAuthProviderButtonProps { provider: OAuthProviderConfig; @@ -20,6 +21,13 @@ const OAuthProviderButton = ({ if (externalDisabled || isLoading) return; console.log(`Starting ${provider.name} OAuth login`, isTauri()); + + if (IS_DEV) { + console.log(`[dev] OAuth debug mode enabled. OAuth URL: ${provider.loginUrl}`); + console.log('[dev] In debug mode, OAuth will return JSON response instead of redirect.'); + console.log('[dev] After OAuth completion, copy the loginToken and use: window.__simulateDeepLink("alphahuman://auth?token=YOUR_TOKEN")'); + } + setIsLoading(true); try { diff --git a/src/components/oauth/providerConfigs.tsx b/src/components/oauth/providerConfigs.tsx index e535f2153..6f4766f00 100644 --- a/src/components/oauth/providerConfigs.tsx +++ b/src/components/oauth/providerConfigs.tsx @@ -2,7 +2,7 @@ * OAuth provider configurations with brand colors and icons */ import type { OAuthProviderConfig } from '../../types/oauth'; -import { BACKEND_URL } from '../../utils/config'; +import { BACKEND_URL, IS_DEV } from '../../utils/config'; // Provider Icons const GoogleIcon = ({ className = '' }: { className?: string }) => ( @@ -40,7 +40,7 @@ export const oauthProviderConfigs: OAuthProviderConfig[] = [ color: 'bg-white border border-gray-200', hoverColor: 'hover:bg-gray-50 hover:border-gray-300', textColor: 'text-gray-900', - loginUrl: `${BACKEND_URL}/auth/google/login`, + loginUrl: `${BACKEND_URL}/auth/google/login${IS_DEV ? '?debug=true' : ''}`, }, { id: 'github', @@ -49,7 +49,7 @@ export const oauthProviderConfigs: OAuthProviderConfig[] = [ color: 'bg-gray-900 border border-gray-800', hoverColor: 'hover:bg-gray-800 hover:border-gray-700', textColor: 'text-white', - loginUrl: `${BACKEND_URL}/auth/github/login`, + loginUrl: `${BACKEND_URL}/auth/github/login${IS_DEV ? '?debug=true' : ''}`, }, { id: 'twitter', @@ -58,7 +58,7 @@ export const oauthProviderConfigs: OAuthProviderConfig[] = [ color: 'bg-black border border-gray-800', hoverColor: 'hover:bg-gray-900 hover:border-gray-700', textColor: 'text-white', - loginUrl: `${BACKEND_URL}/auth/twitter/login`, + loginUrl: `${BACKEND_URL}/auth/twitter/login${IS_DEV ? '?debug=true' : ''}`, }, { id: 'discord', @@ -67,7 +67,7 @@ export const oauthProviderConfigs: OAuthProviderConfig[] = [ color: 'bg-indigo-600 border border-indigo-500', hoverColor: 'hover:bg-indigo-700 hover:border-indigo-600', textColor: 'text-white', - loginUrl: `${BACKEND_URL}/auth/discord/login`, + loginUrl: `${BACKEND_URL}/auth/discord/login${IS_DEV ? '?debug=true' : ''}`, }, ];