mirror of
https://github.com/tinyhumansai/openhuman.git
synced 2026-07-29 22:23:01 +00:00
Add OAuth debug mode support for development environments
Introduce `IS_DEV` checks to enable OAuth debug mode, allowing detailed logging and adjustable OAuth URLs with debug parameters during development.
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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' : ''}`,
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user