@onairos/react-native 3.7.1 โ 3.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/api/index.js +219 -9
- package/lib/commonjs/assets/icons/spotify.png +0 -0
- package/lib/commonjs/assets/images/spotify.png +0 -0
- package/lib/commonjs/components/BodyText.js +27 -9
- package/lib/commonjs/components/BrandMark.js +111 -10
- package/lib/commonjs/components/CodeInput.js +116 -9
- package/lib/commonjs/components/EmailInput.js +30 -8
- package/lib/commonjs/components/GoogleButton.js +56 -9
- package/lib/commonjs/components/HeadingGroup.js +43 -9
- package/lib/commonjs/components/LLMDataInputModal.js +664 -14
- package/lib/commonjs/components/ModalHeader.js +99 -9
- package/lib/commonjs/components/ModalSheet.js +47 -9
- package/lib/commonjs/components/Onairos.js +380 -14
- package/lib/commonjs/components/OnairosButton.js +313 -13
- package/lib/commonjs/components/OnairosSignInButton.js +130 -12
- package/lib/commonjs/components/Overlay.js +465 -13
- package/lib/commonjs/components/PersonaImage.js +137 -10
- package/lib/commonjs/components/PersonaLoadingScreen.js +318 -12
- package/lib/commonjs/components/PersonalizationConsentScreen.js +467 -13
- package/lib/commonjs/components/PinCreationScreen.js +403 -12
- package/lib/commonjs/components/PinInput.js +464 -9
- package/lib/commonjs/components/PlatformConnectorsStep.js +1311 -23
- package/lib/commonjs/components/PlatformList.js +137 -10
- package/lib/commonjs/components/PlatformToggle.js +180 -9
- package/lib/commonjs/components/PrimaryButton.js +180 -10
- package/lib/commonjs/components/SignInMatchAnimation.js +197 -9
- package/lib/commonjs/components/SignInStep.js +345 -12
- package/lib/commonjs/components/UniversalOnboarding.js +2780 -30
- package/lib/commonjs/components/VerificationStep.js +176 -11
- package/lib/commonjs/components/WelcomeScreen.js +461 -22
- package/lib/commonjs/components/icons/Basicproficon.js +37 -8
- package/lib/commonjs/components/icons/Basicprofile.js +21 -8
- package/lib/commonjs/components/icons/Checkbox.js +21 -8
- package/lib/commonjs/components/icons/Checkmark.js +27 -8
- package/lib/commonjs/components/icons/Contentanalysis.js +21 -8
- package/lib/commonjs/components/icons/Contenticon.js +39 -8
- package/lib/commonjs/components/icons/EnochE.js +41 -8
- package/lib/commonjs/components/icons/Personalityicon.js +30 -8
- package/lib/commonjs/components/icons/Personalityprofile.js +21 -8
- package/lib/commonjs/components/icons/Personalitytraits.js +21 -8
- package/lib/commonjs/components/icons/Userpreferences.js +21 -8
- package/lib/commonjs/components/icons/index.js +84 -17
- package/lib/commonjs/components/onboarding/OAuthWebView.js +1754 -18
- package/lib/commonjs/components/onboarding/OnboardingHeader.js +74 -10
- package/lib/commonjs/components/onboarding/PinInput.js +283 -10
- package/lib/commonjs/components/onboarding/PlatformConnector.js +249 -11
- package/lib/commonjs/config/PLATFORM_APIS.md +849 -0
- package/lib/commonjs/config/api.js +56 -7
- package/lib/commonjs/constants/index.js +120 -7
- package/lib/commonjs/context/AuthContext.js +345 -10
- package/lib/commonjs/hooks/useConnectedAccounts.js +111 -9
- package/lib/commonjs/hooks/useConnections.js +102 -8
- package/lib/commonjs/hooks/useCredentials.js +178 -10
- package/lib/commonjs/hooks/useUserConnections.js +148 -10
- package/lib/commonjs/index.js +439 -34
- package/lib/commonjs/services/apiClient.js +298 -8
- package/lib/commonjs/services/biometricPinService.js +180 -8
- package/lib/commonjs/services/chatGPTConversationExtractor.js +155 -8
- package/lib/commonjs/services/chatGPTConversationService.js +275 -9
- package/lib/commonjs/services/claudeConversationExtractor.js +103 -8
- package/lib/commonjs/services/claudeConversationService.js +158 -9
- package/lib/commonjs/services/connectedAccountsService.js +310 -10
- package/lib/commonjs/services/googleAuthService.js +252 -11
- package/lib/commonjs/services/hingeDataExtractor.js +105 -8
- package/lib/commonjs/services/hingeDataService.js +150 -9
- package/lib/commonjs/services/imageCompressionService.js +260 -7
- package/lib/commonjs/services/instagramDataExtractor.js +126 -8
- package/lib/commonjs/services/instagramDataService.js +163 -9
- package/lib/commonjs/services/jwtStorageService.js +276 -7
- package/lib/commonjs/services/linkedinDOMExtractor.js +245 -7
- package/lib/commonjs/services/linkedinProfileService.js +222 -9
- package/lib/commonjs/services/linkedinScrapingService.js +230 -8
- package/lib/commonjs/services/llmDataStorage.js +294 -8
- package/lib/commonjs/services/mobileTrainingService.js +186 -8
- package/lib/commonjs/services/netflixDataExtractor.js +120 -8
- package/lib/commonjs/services/netflixDataService.js +198 -9
- package/lib/commonjs/services/pinEncryptionService.js +84 -8
- package/lib/commonjs/services/pinStorageUtils.js +105 -7
- package/lib/commonjs/services/platformAuthService.js +1484 -12
- package/lib/commonjs/services/sephoraDataExtractor.js +140 -8
- package/lib/commonjs/services/sephoraDataService.js +200 -9
- package/lib/commonjs/services/spotifyDataExtractor.js +148 -8
- package/lib/commonjs/services/spotifyDataService.js +241 -9
- package/lib/commonjs/services/storageService.js +404 -8
- package/lib/commonjs/services/telegramDataExtractor.js +115 -8
- package/lib/commonjs/services/telegramDataService.js +499 -9
- package/lib/commonjs/services/trainingApiHelpers.js +73 -7
- package/lib/commonjs/services/userConnectionsService.js +340 -10
- package/lib/commonjs/services/youtubeMigrationService.js +416 -10
- package/lib/commonjs/theme/index.js +250 -7
- package/lib/commonjs/types/ambient.d.js +2 -1
- package/lib/commonjs/types/declarations.d.js +2 -1
- package/lib/commonjs/types/index.js +6 -1
- package/lib/commonjs/types/node-fix.d.js +2 -1
- package/lib/commonjs/types/node-override.d.js +2 -1
- package/lib/commonjs/types/opacity.d.js +2 -1
- package/lib/commonjs/types.js +14 -1
- package/lib/commonjs/utils/Portal.js +98 -8
- package/lib/commonjs/utils/api.js +130 -9
- package/lib/commonjs/utils/assetRegistry.js +210 -35
- package/lib/commonjs/utils/auth.js +112 -9
- package/lib/commonjs/utils/connectorTests.js +613 -29
- package/lib/commonjs/utils/crypto.js +62 -8
- package/lib/commonjs/utils/debugHelper.js +64 -1
- package/lib/commonjs/utils/encryption.js +76 -7
- package/lib/commonjs/utils/eventUtils.js +288 -1
- package/lib/commonjs/utils/haptics.js +66 -9
- package/lib/commonjs/utils/imagePreloader.js +6 -1
- package/lib/commonjs/utils/networkDiagnostics.js +226 -8
- package/lib/commonjs/utils/onairosApi.js +350 -9
- package/lib/commonjs/utils/programmaticFlow.js +117 -9
- package/lib/commonjs/utils/retryHelper.js +220 -1
- package/lib/commonjs/utils/secureStorage.js +349 -10
- package/lib/commonjs/utils/webviewScripts/chatgpt.js +551 -1
- package/lib/commonjs/utils/webviewScripts/claude.js +376 -1
- package/lib/commonjs/utils/webviewScripts/hinge.js +411 -1
- package/lib/commonjs/utils/webviewScripts/index.js +698 -15
- package/lib/commonjs/utils/webviewScripts/instagram.js +454 -1
- package/lib/commonjs/utils/webviewScripts/linkedin.js +880 -1
- package/lib/commonjs/utils/webviewScripts/netflix.js +382 -1
- package/lib/commonjs/utils/webviewScripts/sephora.js +516 -1
- package/lib/commonjs/utils/webviewScripts/spotify.js +419 -1
- package/lib/commonjs/utils/webviewScripts/telegram.js +678 -1
- package/lib/module/api/index.js +211 -1
- package/lib/module/assets/icons/spotify.png +0 -0
- package/lib/module/assets/images/spotify.png +0 -0
- package/lib/module/components/BodyText.js +20 -1
- package/lib/module/components/BrandMark.js +104 -1
- package/lib/module/components/CodeInput.js +109 -1
- package/lib/module/components/EmailInput.js +23 -1
- package/lib/module/components/GoogleButton.js +49 -1
- package/lib/module/components/HeadingGroup.js +36 -1
- package/lib/module/components/LLMDataInputModal.js +656 -7
- package/lib/module/components/ModalHeader.js +92 -1
- package/lib/module/components/ModalSheet.js +39 -1
- package/lib/module/components/Onairos.js +373 -1
- package/lib/module/components/OnairosButton.js +305 -1
- package/lib/module/components/OnairosSignInButton.js +121 -1
- package/lib/module/components/Overlay.js +456 -1
- package/lib/module/components/PersonaImage.js +129 -1
- package/lib/module/components/PersonaLoadingScreen.js +310 -1
- package/lib/module/components/PersonalizationConsentScreen.js +460 -1
- package/lib/module/components/PinCreationScreen.js +396 -1
- package/lib/module/components/PinInput.js +456 -1
- package/lib/module/components/PlatformConnectorsStep.js +1302 -6
- package/lib/module/components/PlatformList.js +129 -1
- package/lib/module/components/PlatformToggle.js +173 -1
- package/lib/module/components/PrimaryButton.js +172 -1
- package/lib/module/components/SignInMatchAnimation.js +189 -1
- package/lib/module/components/SignInStep.js +338 -1
- package/lib/module/components/UniversalOnboarding.js +2770 -1
- package/lib/module/components/VerificationStep.js +168 -1
- package/lib/module/components/WelcomeScreen.js +453 -1
- package/lib/module/components/icons/Basicproficon.js +30 -1
- package/lib/module/components/icons/Basicprofile.js +14 -1
- package/lib/module/components/icons/Checkbox.js +14 -1
- package/lib/module/components/icons/Checkmark.js +20 -1
- package/lib/module/components/icons/Contentanalysis.js +14 -1
- package/lib/module/components/icons/Contenticon.js +32 -1
- package/lib/module/components/icons/EnochE.js +34 -1
- package/lib/module/components/icons/Personalityicon.js +23 -1
- package/lib/module/components/icons/Personalityprofile.js +14 -1
- package/lib/module/components/icons/Personalitytraits.js +14 -1
- package/lib/module/components/icons/Userpreferences.js +14 -1
- package/lib/module/components/icons/index.js +13 -1
- package/lib/module/components/onboarding/OAuthWebView.js +1746 -1
- package/lib/module/components/onboarding/OnboardingHeader.js +66 -1
- package/lib/module/components/onboarding/PinInput.js +274 -1
- package/lib/module/components/onboarding/PlatformConnector.js +240 -1
- package/lib/module/config/PLATFORM_APIS.md +849 -0
- package/lib/module/config/api.js +47 -1
- package/lib/module/constants/index.js +114 -1
- package/lib/module/context/AuthContext.js +335 -1
- package/lib/module/hooks/useConnectedAccounts.js +106 -1
- package/lib/module/hooks/useConnections.js +95 -1
- package/lib/module/hooks/useCredentials.js +171 -6
- package/lib/module/hooks/useUserConnections.js +140 -1
- package/lib/module/index.js +172 -1
- package/lib/module/services/apiClient.js +295 -1
- package/lib/module/services/biometricPinService.js +169 -1
- package/lib/module/services/chatGPTConversationExtractor.js +149 -1
- package/lib/module/services/chatGPTConversationService.js +268 -1
- package/lib/module/services/claudeConversationExtractor.js +97 -1
- package/lib/module/services/claudeConversationService.js +151 -1
- package/lib/module/services/connectedAccountsService.js +293 -1
- package/lib/module/services/googleAuthService.js +241 -1
- package/lib/module/services/hingeDataExtractor.js +99 -1
- package/lib/module/services/hingeDataService.js +143 -1
- package/lib/module/services/imageCompressionService.js +250 -1
- package/lib/module/services/instagramDataExtractor.js +120 -1
- package/lib/module/services/instagramDataService.js +156 -1
- package/lib/module/services/jwtStorageService.js +257 -1
- package/lib/module/services/linkedinDOMExtractor.js +234 -1
- package/lib/module/services/linkedinProfileService.js +210 -1
- package/lib/module/services/linkedinScrapingService.js +219 -1
- package/lib/module/services/llmDataStorage.js +277 -1
- package/lib/module/services/mobileTrainingService.js +173 -1
- package/lib/module/services/netflixDataExtractor.js +114 -1
- package/lib/module/services/netflixDataService.js +191 -1
- package/lib/module/services/pinEncryptionService.js +74 -6
- package/lib/module/services/pinStorageUtils.js +93 -1
- package/lib/module/services/platformAuthService.js +1461 -1
- package/lib/module/services/sephoraDataExtractor.js +134 -1
- package/lib/module/services/sephoraDataService.js +193 -1
- package/lib/module/services/spotifyDataExtractor.js +142 -1
- package/lib/module/services/spotifyDataService.js +234 -1
- package/lib/module/services/storageService.js +383 -1
- package/lib/module/services/telegramDataExtractor.js +109 -1
- package/lib/module/services/telegramDataService.js +493 -1
- package/lib/module/services/trainingApiHelpers.js +67 -1
- package/lib/module/services/userConnectionsService.js +329 -1
- package/lib/module/services/youtubeMigrationService.js +405 -1
- package/lib/module/theme/index.js +245 -1
- package/lib/module/types.js +10 -1
- package/lib/module/utils/Portal.js +90 -1
- package/lib/module/utils/api.js +118 -1
- package/lib/module/utils/assetRegistry.js +200 -34
- package/lib/module/utils/auth.js +100 -1
- package/lib/module/utils/connectorTests.js +600 -27
- package/lib/module/utils/crypto.js +54 -1
- package/lib/module/utils/debugHelper.js +54 -1
- package/lib/module/utils/encryption.js +67 -1
- package/lib/module/utils/eventUtils.js +270 -1
- package/lib/module/utils/haptics.js +59 -8
- package/lib/module/utils/imagePreloader.js +3 -1
- package/lib/module/utils/networkDiagnostics.js +217 -1
- package/lib/module/utils/onairosApi.js +333 -1
- package/lib/module/utils/programmaticFlow.js +111 -1
- package/lib/module/utils/retryHelper.js +211 -1
- package/lib/module/utils/secureStorage.js +330 -6
- package/lib/module/utils/webviewScripts/chatgpt.js +545 -1
- package/lib/module/utils/webviewScripts/claude.js +370 -1
- package/lib/module/utils/webviewScripts/hinge.js +405 -1
- package/lib/module/utils/webviewScripts/index.js +434 -1
- package/lib/module/utils/webviewScripts/instagram.js +448 -1
- package/lib/module/utils/webviewScripts/linkedin.js +874 -1
- package/lib/module/utils/webviewScripts/netflix.js +376 -1
- package/lib/module/utils/webviewScripts/sephora.js +510 -1
- package/lib/module/utils/webviewScripts/spotify.js +413 -1
- package/lib/module/utils/webviewScripts/telegram.js +672 -1
- package/package.json +2 -2
|
@@ -1 +1,1461 @@
|
|
|
1
|
-
function _0x38c4(){const _0x23632f=['SDK\x20not\x20initialized.\x20Developers\x20must\x20call\x20initializeApiKey()\x20before\x20using\x20auth\x20features.','QJRrE','Nrbsa','Qmaql','Apbis','AhDWG','apiKey','No\x20API\x20key\x20configured.\x20Please\x20initialize\x20the\x20SDK\x20with\x20a\x20valid\x20developer\x20API\x20key.','lFOXt','1030678346906-lovkuds2ouqmoc8eu5qpo98spa6edv4o.apps.googleusercontent.com','https://api.instagram.com/oauth/authorize','demo_instagram_client_id','onairosevents://auth/callback','code','BASE_URL','/youtube/authorize','https://www.googleapis.com/auth/youtube.readonly','demo_reddit_client_id','/pinterest/authorize','demo_pinterest_client_id','demo_facebook_client_id','/linkedin/authorize','openid\x20profile\x20email','/gmail/authorize','demo_gmail_client_id','https://www.googleapis.com/auth/gmail.readonly','/email/authorize','https://claude.ai/login','https://gemini.google.com','https://hinge.co','https://www.instagram.com','hasNativeSDK','Invalid\x20verification\x20code','temp_token_for_youtube_connection','โ
\x20[CONNECTIVITY]\x20API\x20server\x20is\x20reachable','https://www.google.com','HEAD','no-cors','reachable','โ
\x20[CONNECTIVITY]\x20Google\x20is\x20reachable\x20-\x20internet\x20is\x20working','ILZBn','๐\x20[CONNECTIVITY]\x20Test\x202:\x20Checking\x20API\x20server...','โ\x20[CONNECTIVITY]\x20Cannot\x20reach\x20API\x20server:','API\x20is\x20reachable','No\x20internet\x20connectivity\x20detected.\x20Check\x20your\x20network\x20connection.','โ\x20[CONNECTIVITY]\x20Connectivity\x20test\x20failed:','EaotC','gyqWi','vEFOE','log','qJnOQ','RIyZt','googleTest','BzDKa','KIcHw','gaCwH','message','error','โ\x20[CONNECTIVITY]\x20Cannot\x20reach\x20Google\x20-\x20internet\x20may\x20be\x20down:','JRLaH','dHJlt','abort','/health','dtOse','catch','Unable\x20to\x20read\x20response','api2Test','status','statusText','substring','kVaYg','zZfnO','โ ๏ธ\x20[CONNECTIVITY]\x20API\x20server\x20responded\x20with\x20status:\x20','sgEuq','name','KWgkW','caSuS','kiuKT','success','ahDcV','Internet\x20works\x20but\x20API\x20server\x20is\x20unreachable.\x20The\x20server\x20may\x20be\x20blocking\x20requests\x20from\x20this\x20device/simulator.','IlyQf','uytfv','โ ๏ธ\x20[YOUTUBE\x20REAUTH]\x20Backend\x20did\x20NOT\x20confirm\x20refresh\x20token\x20reception','โ ๏ธ\x20[YOUTUBE\x20REAUTH]\x20Expected\x20hasRefreshToken\x20or\x20refreshTokenReceived\x20in\x20response','โ\x20User\x20not\x20signed\x20in\x20to\x20Google,\x20cannot\x20refresh\x20tokens','๐\x20Refresh\x20token\x20type:','serverAuthCode','refreshToken','\x20\x20\x201.\x20No\x20internet\x20connection\x20on\x20device/simulator','\x20\x20\x202.\x20API\x20server\x20(API\x20server)\x20is\x20unreachable','\x20\x20\x204.\x20SSL/TLS\x20certificate\x20issue','AbortError','Network\x20request\x20failed','ABLGe','1|2|0|3|4|5','\x20\x20\x205.\x20iOS\x20simulator\x20network\x20sandbox\x20issue\x20-\x20try\x20on\x20physical\x20device','nMXmn','๐\x20[OAUTH]\x20Starting\x20OAuth\x20for\x20platform:\x20','๐ฑ\x20[OAUTH]\x20Platform:\x20',',\x20Version:\x20','Version','GATgE','rTCbp','lLZBh','/email/authorize?action=verify','โ\x20[OAUTH]\x20User\x20not\x20authenticated\x20-\x20cannot\x20initiate\x20','\x20OAuth','โ\x20[OAUTH]\x20Please\x20log\x20in\x20first\x20before\x20connecting\x20platforms','/authorize','๐\x20[OAUTH]\x20Proxy\x20URL:\x20','๐\x20[OAUTH]\x20About\x20to\x20make\x20fetch\x20request...','toISOString','๐ค\x20[OAUTH]\x20Request\x20body:','SWypm','goALr','XAmlq','warn','โ ๏ธ\x20[YOUTUBE\x20REAUTH]\x20Response\x20data:','HfTuM','โฐ\x20[OAUTH]\x20Request\x20timeout\x20for\x20','\x20-\x20aborting','stringify','signal','OCkUA','๐ก\x20[OAUTH]\x20Response\x20status:\x20','VPDJh','FOhjF','โ\x20[OAUTH]\x20Error\x20initiating\x20OAuth\x20for\x20','\x20-\x20','kLqdo','๐\x20[OAUTH]\x20Response\x20data\x20for\x20','๐\x20[OAUTH]\x20Auth\x20URL\x20for\x20','\x20(key:\x20','DDVcZ','\x20-\x20the\x20server\x20took\x20too\x20long\x20to\x20respond','lSmth','zorVx','startsWith','hXUCx','wQUrT','split','rBXRI','โ\x20[OAUTH]\x20Network\x20request\x20failed\x20for\x20','.\x20Possible\x20causes:','YZzLI','LuzXk','oDjPc','LvpoZ','ZDNPZ','DXVPg','email','sFaFP','iElNA','profile','xffnH','โ\x20YouTube\x20reconnection\x20failed','Email\x20verified\x20successfully','โ\x20CRITICAL:\x20No\x20refresh\x20token\x20available\x20-\x20YouTube\x20connection\x20will\x20fail\x20when\x20token\x20expires','๐ก\x20User\x20needs\x20to\x20reconnect\x20with\x20proper\x20consent\x20screen','๐ก\x20Check\x20Google\x20Sign-In\x20configuration:\x20offlineAccess,\x20forceCodeForRefreshToken','โ ๏ธ\x20Continuing\x20without\x20refresh\x20token\x20-\x20connection\x20may\x20fail\x20later','โ\x20No\x20auth\x20token\x20found\x20for\x20YouTube\x20refresh','ID:','โ ๏ธ\x20Failed\x20to\x20fetch\x20YouTube\x20channel\x20info:','Unknown\x20Channel','โ\x20Google\x20Play\x20Services\x20not\x20available','โ\x20CRITICAL:\x20No\x20refresh\x20token\x20even\x20after\x20consent\x20screen','๐ก\x20Solutions:','\x20\x20\x202.\x20Check\x20Google\x20Console\x20OAuth\x20configuration','BkWZo','๐ค\x20User:','dDYMx','SsbkG','bkUSe','โ
\x20Token\x20cache\x20cleared','๐ง\x20Configuring\x20Google\x20Sign-In\x20for\x20forced\x20consent...','openid','โ
\x20Play\x20Services\x20available','โ
\x20Sign-in\x20completed\x20-\x20checking\x20for\x20refresh\x20token...','๐\x20FULL\x20userInfo\x20object\x20from\x20forceYouTubeReconnectionWithConsent:','๐\x20FULL\x20tokens\x20object\x20from\x20forceYouTubeReconnectionWithConsent:','-\x20Access\x20token:','Missing','Present','-\x20ServerAuthCode\x20(userInfo):','โ
\x20SUCCESS:\x20Got\x20refresh\x20token\x20after\x20consent!','๐\x20Refresh\x20token\x20preview:','XDRlQ','๐บ\x20Fetching\x20YouTube\x20channel\x20information...','Tymbb','NVvbR','PSRyE','LhUci','โ ๏ธ\x20No\x20YouTube\x20channel\x20found\x20for\x20user','dVeIu','โ ๏ธ\x20Error\x20fetching\x20YouTube\x20channel\x20info:','youtube','๐ค\x20Sending\x20comprehensive\x20payload\x20with\x20REFRESH\x20TOKEN\x20to\x20backend:','๐\x20[YOUTUBE\x20REAUTH]\x20Headers:','๐ก\x20[YOUTUBE\x20REAUTH]\x20Response\x20Status:','๐ก\x20[YOUTUBE\x20REAUTH]\x20Response\x20Status\x20Text:','๐ก\x20[YOUTUBE\x20REAUTH]\x20Response\x20Headers:','temporary\x20access\x20token\x20mode','PxUYq','โ
\x20[YOUTUBE\x20REAUTH]\x20Training\x20will\x20work,\x20but\x20connection\x20expires\x20in\x20~1\x20hour','๐\x20[YOUTUBE\x20REAUTH]\x20SUCCESS:\x20Temporary\x20YouTube\x20connection\x20established!','Yes','๐\x20[YOUTUBE\x20REAUTH]\x20REFRESH\x20TOKEN\x20SENT\x20TO\x20BACKEND:','โ
\x20[YOUTUBE\x20REAUTH]\x20Backend\x20CONFIRMED\x20refresh\x20token\x20received','๐\x20[YOUTUBE\x20REAUTH]\x20Signaling\x20training\x20system\x20to\x20restart...','YePhu','NrmyF','VynJu','โ\x20[YOUTUBE\x20REAUTH]\x20This\x20means\x20the\x20reauth\x20signal\x20was\x20not\x20processed','โ\x20Error\x20forcing\x20YouTube\x20consent:','โ\x20User\x20cancelled\x20sign-in\x20-\x20no\x20refresh\x20token\x20obtained','๐ก\x20User\x20must\x20click\x20\x22Allow\x22\x20to\x20get\x20refresh\x20token','QNpWZ','๐\x20FORCING\x20fresh\x20YouTube\x20consent\x20for\x20refresh\x20token...','BMLRg','gkCrF','UxStN','signOut','WwhOt','accessToken','clearCachedAccessToken','mZAeE','โน๏ธ\x20No\x20token\x20cache\x20to\x20clear','QoHqY','configure','cqoMV','ebujI','MLYHQ','hasPlayServices','uFSib','jRpzk','YvEzA','lueKi','PFneQ','data','CYqXG','UySLW','user','fHctK','getCurrentUser','HInWR','qdftD','๐\x20FULL\x20currentUser\x20object\x20from\x20forceYouTubeReconnectionWithConsent:','๐\x20Token\x20analysis:','DsKtI','-\x20ID\x20token:','idToken','ybcUd','GsqML','...','DekMc','-\x20ServerAuthCode\x20(currentUser):','wpoyh','icyWP','ozUuO','LsHQa','Fitjy','nPHEf','HpOSj','gvABI','ZqCzs','Bearer\x20','json','items','length','aIGuo','jLHmD','JzsrR','snippet','โ
\x20YouTube\x20channel\x20found:','tIOsW','IADJZ','RkDrP','FtEHa','SPcgl','No\x20Channel','ZnZrD','aWVlY','BMAec','DmgKu','cRlRj','AocFn','ITsQS','existingUser','token','KOGbg','JfASu','hHwYE','ZdlqC','SZbGc','soUyA','iOJWs','ESMKO','pTEQt','nsHGk','trim','๐\x20Creating\x20authentication\x20token\x20for\x20YouTube\x20connection...','hYCuI','TnwDY','qrwpt','user-','youtube-','HRQeP','TkZJs','now','LSEFZ','debugInfo','refreshTokenType','cSqfr','๐\x20[YOUTUBE\x20REAUTH]\x20=====\x20SENDING\x20REAUTH\x20SIGNAL\x20TO\x20BACKEND\x20=====','xcEkm','UqcEo','๐\x20[YOUTUBE\x20REAUTH]\x20Payload\x20Summary:','gbtCO','TLwjZ','dzKJe','/youtube/native-auth','ocxfL','lrZix','ULhuD','vFrgy','headers','โ
\x20[YOUTUBE\x20REAUTH]\x20Backend\x20Response\x20SUCCESS:','EXlpe','validation','isTemporaryMode','qSQMn','temporaryMode','enabled','YEGCs','includes','grsTf','VfwWb','๐\x20[YOUTUBE\x20REAUTH]\x20YouTube\x20connected\x20in\x20temporary\x20mode','Nvsaa','nRhJL','๐\x20[YOUTUBE\x20REAUTH]\x20Mode:\x20Temporary\x20(expires\x20~1\x20hour)','๐\x20[YOUTUBE\x20REAUTH]\x20Training\x20Ready:\x20Yes','hasRefreshToken','refreshTokenReceived','nixmK','๐\x20[YOUTUBE\x20REAUTH]\x20Full\x20refresh\x20token:','โ
\x20[YOUTUBE\x20REAUTH]\x20Response\x20hasRefreshToken:','๐\x20[YOUTUBE\x20REAUTH]\x20SUCCESS:\x20Full\x20YouTube\x20connection\x20with\x20refresh\x20tokens!','EXJya','XZjgz','IzEMp','OGvBc','RhZjI','afHgB','UsXEx','title','โ ๏ธ\x20[YOUTUBE\x20REAUTH]\x20Training\x20restart\x20signal\x20failed:','SMUoJ','bKkNF','OicvD','PDmCK','EqAHN','rigRR','YfVBQ','uKIyK','pfYRh','KzgPT','ArAkL','SIGN_IN_CANCELLED','PGzYv','VnAxt','IN_PROGRESS','DIotA','โ\x20Sign-in\x20already\x20in\x20progress','PLAY_SERVICES_NOT_AVAILABLE','jkdLZ','โน๏ธ\x20No\x20existing\x20permissions\x20to\x20revoke:','โ
\x20Signed\x20out\x20completely','๐\x20Signing\x20in\x20after\x20revoke\x20-\x20consent\x20screen\x20MUST\x20appear...','vEpDd','ezLbC','โ
\x20SUCCESS:\x20Got\x20refresh\x20token\x20after\x20REVOKE\x20+\x20consent!','โ\x20Still\x20no\x20refresh\x20token\x20after\x20revoke\x20method','yWOXV','OuUpc','๐\x20FORCING\x20YouTube\x20consent\x20via\x20REVOKE\x20method...','revokeAccess','JlCwe','sYvcL','bZACr','nCmJL','signIn','getTokens','Qtlyz','YzZVd','YzQpS','BfKNn','JGiIr','pyObR','eHrPx','chyur','wVOxV','MFOTS','iKRVp','๐\x20Method\x201:\x20Trying\x20forced\x20consent\x20via\x20configuration...','xbsvt','๐ง\x20Fixing\x20YouTube\x20connection\x20for\x20user:\x20','GDWbY','dcATt','\x20YouTube\x20connection\x20fixed\x20via\x20Method\x201!','๐\x20Method\x202:\x20Trying\x20forced\x20consent\x20via\x20revoke...','lSubJ','ykRpZ','\x20YouTube\x20connection\x20fixed\x20via\x20Method\x202!','๐\x20Attempting\x20to\x20refresh\x20Google\x20tokens...','โ
\x20Successfully\x20refreshed\x20Google\x20tokens','โ\x20Failed\x20to\x20refresh\x20Google\x20tokens:','โ
\x20Re-authentication\x20successful','iEawZ','rPvKl','asqLj','UOzKO','ZOiHO','Whqiy','rJswL','โ
\x20Got\x20serverAuthCode\x20(refresh\x20token\x20mechanism)','oLrYz','๐\x20YouTube\x20Token\x20Debug:','zIycj','RrHGc','hhDeU','WAmWH','AUcjN','JxRoV','XlmWZ','none','โ\x20Debug\x20tokens\x20failed:','kPvQV','3.0.72','โน๏ธ\x20Sign\x20out\x20not\x20needed\x20or\x20failed:','Facebook\x20Login\x20completed\x20successfully','๐\x20Forcing\x20fresh\x20YouTube\x20reconnection\x20for\x20refresh\x20token...','ZSFSj','MXnSy','โ
\x20Cleared\x20cached\x20access\x20token','โน๏ธ\x20Token\x20clearing\x20failed\x20or\x20not\x20needed:','โ
\x20YouTube\x20reconnected\x20successfully\x20with\x20refresh\x20token','LWjcO','โ
\x20Refresh\x20token\x20confirmed:','YZVRN','ElkEl','โ\x20YouTube\x20reconnection\x20error:','RPjwH','HsIvE','xKELj','XXYVe','LIRhK','xBdVO','TjzWx','CXazM','JeHsm','XOvep','eGJzk','GpYIL','ZOFmP','jyJTY','EMsGR','axwnM','tWRIv','okcyk','PGmBu','PAucQ','ExQcH','FPFvL','siyNr','โ ๏ธ\x20Still\x20no\x20refresh\x20token\x20after\x20reconnection','Bicbx','auth/callback','code=','โ\x20Error\x20refreshing\x20YouTube\x20tokens:','\x20\x20\x203.\x20DNS\x20resolution\x20failed','Initiating\x20Facebook\x20Login\x20for\x20Instagram','โ\x20No\x20current\x20Google\x20user\x20found','โ\x20[YOUTUBE\x20AUTH]\x20Username\x20is\x20required\x20for\x20YouTube\x20authentication','tszKf','hEyAh','๐\x20Signed\x20out\x20to\x20force\x20fresh\x20consent','๐\x20Got\x20Google\x20tokens','๐\x20FULL\x20currentUser\x20object:','๐\x20REFRESH\x20TOKEN\x20EXTRACTION:','-\x20userInfo.data?.serverAuthCode:','-\x20tokens.idToken:','-\x20tokens.accessToken:','โ
\x20Got\x20serverAuthCode\x20from\x20sign-in\x20response','mSyfS','โ
\x20Refresh\x20token\x20available\x20for\x20YouTube\x20connection','https://www.googleapis.com/youtube/v3/channels?part=snippet&mine=true','kkEsq','โน๏ธ\x20User\x20should\x20authenticate\x20first\x20via\x20Google/Apple/Email\x20before\x20connecting\x20YouTube','๐\x20Token\x20preview:','๐\x20Linking\x20YouTube\x20data\x20to\x20user:','๐\x20Using\x20auth\x20token\x20for\x20linking:','No\x20token','apple','๐ค\x20BACKEND\x20PAYLOAD\x20SUMMARY:','-\x20hasRefreshToken:','๐ก\x20Backend\x20response\x20status:','๐ก\x20Backend\x20response\x20headers:','lwzms','โ
\x20YouTube\x20connection\x20successful','hfvma','๐\x20[YOUTUBE\x20AUTH]\x20YouTube\x20connected\x20in\x20temporary\x20mode','โ
\x20[YOUTUBE\x20AUTH]\x20Training\x20will\x20work,\x20but\x20connection\x20expires\x20in\x20~1\x20hour','โ
\x20[YOUTUBE\x20AUTH]\x20Backend\x20confirmed\x20refresh\x20token\x20received','โ
\x20[YOUTUBE\x20AUTH]\x20Full\x20YouTube\x20connection\x20with\x20persistent\x20access','๐\x20[YOUTUBE\x20AUTH]\x20Response\x20data\x20keys:','โ ๏ธ\x20[YOUTUBE\x20AUTH]\x20Connection\x20may\x20fail\x20when\x20tokens\x20expire','โ\x20YouTube\x20auth\x20failed:','BjURc','imzzQ','โ\x20Google\x20Sign-In\x20error:','Google\x20Sign-In\x20already\x20in\x20progress','Obozt','LctwL','Google\x20Play\x20Services\x20not\x20available','instagram','nLtUz','๐\x20Initiating\x20native\x20Google\x20Sign-In\x20for\x20YouTube','xOCtg','zJUks','zNtFd','lTUcX','woTVM','HIxcb','bECRC','nWJbn','WINpt','IDiHw','โ
\x20Google\x20Sign-In\x20successful:','YkBBN','ayREa','UUhOr','JMkLv','iOHSa','๐\x20FULL\x20tokens\x20object:','XrtWb','LWnDJ','IqfUh','XzWFu','Present:\x20','nkzVy','UnZQR','oiCaA','CFFNs','PXSui','EwMhK','ZtFby','BikaZ','aaMGH','JRVlb','bMuZW','QyUqj','YgWBl','YhSTz','HtdrE','skIwU','jLIse','Fxama','aTAxM','UwTXa','ASQan','ScEYv','JHglC','DOzQf','WoKtp','WRrVF','RhKoF','QjetR','ygzuW','MxOtl','Hsghs','ilrnx','iOBGB','kdzLa','DwTIQ','qbMMy','lcZzT','getItem','ajKeJ','AKBqu','jHqEI','youtube_user','TPgUT','WLpAV','ywSjV','nHUqR','ThtkA','โ
\x20Found\x20existing\x20authentication\x20token\x20for\x20YouTube\x20auth','qpxqW','4|6|3|0|2|1|5','๐\x20[YOUTUBE\x20REAUTH]\x20Connection\x20Details:','Zidwu','Dwskq','SYniM','jGHON','UNdCW','CBBvl','uTYmo','CokdD','QWzZl','UrxeG','AeGuh','DyIcp','vfcOc','sYAuA','rkyRP','tUTdT','CIfdm','UtbtE','-\x20hasAccessToken:','YeWSF','aHnhO','-\x20refreshTokenType:','-\x20userEmail:','auAGJ','daADM','-\x20channelName:','AhfFL','gqxLT','FhAXI','ykapR','QzBRd','jMQeH','FUqiS','gOTUn','โน๏ธ\x20[YOUTUBE\x20AUTH]\x20User\x20can\x20reconnect\x20later\x20for\x20refresh\x20tokens\x20if\x20needed','Failed\x20to\x20send\x20verification\x20code','FGJUG','vdEzW','โ\x20[OAUTH]\x20Request\x20timeout\x20for\x20','QDYHn','LbJTy','coUvf','htopi','yZKFv','zmRkK','โ ๏ธ\x20[YOUTUBE\x20AUTH]\x20Backend\x20did\x20not\x20confirm\x20refresh\x20token','jrtRE','fypbx','ACRbd','text','LLVPw','๐\x20BACKEND\x20ERROR\x20RESPONSE:','hDHom','MtZyN','VPXlW','tkofn','dPTgC','PAnPr','UOVGP','hxFqe','nVoGe','ydXIq','HQoDi','VisOj','lKPNQ','VmZHE','XCMOj','PGlCf','lifJG','Falling\x20back\x20to\x20simulated\x20token\x20response','Exchanging\x20code\x20for\x20token\x20for\x20platform:\x20','pPcIl','tLVmY','/token','QUjVi','kqCXN','pxRzz','FXVCY','Error\x20exchanging\x20code\x20for\x20token:\x20','Token\x20exchange\x20successful\x20for\x20','KCduf','Error\x20exchanging\x20code\x20for\x20token:','wvusU','_access_token_','_refresh_token_','random','toString','โน๏ธ\x20Already\x20signed\x20out\x20or\x20sign\x20out\x20failed:','๐\x20Refreshing\x20YouTube\x20tokens...','โ\x20Failed\x20to\x20get\x20fresh\x20tokens\x20from\x20Google\x20SDK','rFtzu','โ
\x20YouTube\x20tokens\x20refreshed\x20successfully:','bCACH','Zyddm','UTrTF','relfc','zuAsP','/youtube/refresh-token','HjpeD','hemHd','WDtaZ','aebda','RthtJ','yGrqx','keys','hWsoU','lIYhE','XdlyE','๐\x20[TRAINING\x20RESTART]\x20Triggering\x20training\x20restart\x20for\x20user:','youtube_reauth','โ
\x20[TRAINING\x20RESTART]\x20Training\x20restart\x20successful:','โ\x20[TRAINING\x20RESTART]\x20Training\x20restart\x20failed:','FVjKD','PEMLJ','mTsPB','EHNGk','WNUpM','Training\x20restart\x20failed:\x20','sCEso','gdhwf','pxGeq','โน๏ธ\x20Sign\x20out\x20not\x20needed:','๐งช\x20Testing\x20YouTube\x20refresh\x20token\x20functionality...','oxWKI','vWpDT','๐\x20Current\x20token\x20status:','โ ๏ธ\x20No\x20refresh\x20token\x20found\x20-\x20attempting\x20to\x20fix...','โ
\x20YouTube\x20connection\x20fixed!\x20Testing\x20again...','โ\x20Failed\x20to\x20fix\x20YouTube\x20connection','โ
\x20Refresh\x20token\x20already\x20available','OlQpr','YgqZb','PoCWU','BkSvd','rIWuC','kwJIy','qztQA','isPAn','๐\x20New\x20token\x20status:','gaSnJ','cJuXA','โ\x20Error\x20testing\x20YouTube\x20refresh\x20token:','โ\x20Error\x20verifying\x20email\x20code:','Network\x20error.\x20Please\x20check\x20your\x20connection\x20and\x20try\x20again.','๐ง\x20Requesting\x20email\x20verification\x20for:','XuCNz','YYyMh','โ\x20Error\x20requesting\x20email\x20verification:','LNhmj','/email/verification','hIrUa','request','wCTZl','tImge','BnXyr','UPvyw','elTCg','๐\x20Verifying\x20email\x20code\x20for:','verify','HSqTI','BrnJh','CcpJZ','dETYt','puztv','VqwrW','rMUcW','HVxOC','RetEz','Xvqht','VJyoC','ZnsaO','QTITL','mTrVK','KwdLs','trEHM','TidcS','vROXO','โ\x20Error\x20checking\x20email\x20verification\x20status:','eNhQM','lIoEv','WbOGz','OqJAj','๐ง\x20Platform\x20auth\x20service\x20initialized','oLfsQ'];_0x38c4=function(){return _0x23632f;};return _0x38c4();}import{Platform}from'react-native';function _0x1519(_0x38c418,_0x15193b){_0x38c418=_0x38c418-0x0;const _0x45b7b3=_0x38c4();let _0x56cb11=_0x45b7b3[_0x38c418];return _0x56cb11;}import{GoogleSignin,statusCodes}from'@react-native-google-signin/google-signin';import AsyncStorage from'@react-native-async-storage/async-storage';import{API_CONFIG,getApiHeaders,getUserAuthHeaders}from'../config/api';import{getApiConfig,isApiKeyInitialized}from'./apiKeyService';import{getJWT}from'./jwtStorageService';const getDeveloperAuthHeaders=()=>{const _0x26019b={'AhDWG':_0x1519(0x0),'Qmaql':_0x1519(0x1),'Apbis':_0x1519(0x2),'qoAEI':function(_0xd90b51,_0x387b50){return _0xd90b51!==_0x387b50;},'lFOXt':function(_0x20c946){return _0x20c946();},'vOiZD':'3.0.72'};if(!isApiKeyInitialized()){if(_0x26019b[_0x1519(0x3)]===_0x26019b[_0x1519(0x4)])throw new _0x1061a7(_0x26019b[_0x1519(0x5)]);else throw new Error(_0x26019b[_0x1519(0x5)]);}const _0x3def29=getApiConfig();if(!(_0x26019b['qoAEI'](_0x3def29,null)&&_0x3def29!==void 0x0&&_0x3def29[_0x1519(0x6)]))throw new Error(_0x1519(0x7));return{..._0x26019b[_0x1519(0x8)](getApiHeaders),'Authorization':'Bearer\x20'+_0x3def29[_0x1519(0x6)],'X-SDK-Version':_0x26019b['vOiZD'],'X-SDK-Platform':'react-native'};},WEB_CLIENT_ID=_0x1519(0x9),IOS_CLIENT_ID=_0x1519(0x9),OAUTH_CONFIG={'instagram':{'authUrl':_0x1519(0xa),'clientId':_0x1519(0xb),'redirectUri':_0x1519(0xc),'scope':'user_profile,user_media','responseType':_0x1519(0xd),'hasNativeSDK':![]},'youtube':{'authUrl':API_CONFIG[_0x1519(0xe)]+_0x1519(0xf),'clientId':'1030678346906-lovkuds2ouqmoc8eu5qpo98spa6edv4o.apps.googleusercontent.com','redirectUri':'onairosevents://auth/callback','scope':_0x1519(0x10),'responseType':'code','hasNativeSDK':!![]},'reddit':{'authUrl':API_CONFIG[_0x1519(0xe)]+'/reddit/authorize','clientId':_0x1519(0x11),'redirectUri':_0x1519(0xc),'scope':'identity,read','responseType':_0x1519(0xd),'hasNativeSDK':![]},'pinterest':{'authUrl':API_CONFIG['BASE_URL']+_0x1519(0x12),'clientId':_0x1519(0x13),'redirectUri':_0x1519(0xc),'scope':'boards:read,pins:read','responseType':_0x1519(0xd),'hasNativeSDK':![]},'facebook':{'authUrl':'https://www.facebook.com/v12.0/dialog/oauth','clientId':_0x1519(0x14),'redirectUri':_0x1519(0xc),'scope':'public_profile,email','responseType':_0x1519(0xd),'hasNativeSDK':![]},'linkedin':{'authUrl':API_CONFIG['BASE_URL']+_0x1519(0x15),'clientId':'','redirectUri':'onairosevents://auth/callback','scope':_0x1519(0x16),'responseType':_0x1519(0xd),'hasNativeSDK':![]},'gmail':{'authUrl':API_CONFIG['BASE_URL']+_0x1519(0x17),'clientId':_0x1519(0x18),'redirectUri':_0x1519(0xc),'scope':_0x1519(0x19),'responseType':_0x1519(0xd),'hasNativeSDK':![]},'email':{'hasNativeSDK':![],'authUrl':API_CONFIG[_0x1519(0xe)]+_0x1519(0x1a)},'chatgpt':{'authUrl':'https://chat.openai.com','clientId':'','redirectUri':'','scope':'','responseType':'','hasNativeSDK':![]},'claude':{'authUrl':_0x1519(0x1b),'clientId':'','redirectUri':'','scope':'','responseType':'','hasNativeSDK':![]},'gemini':{'authUrl':_0x1519(0x1c),'clientId':'','redirectUri':'','scope':'','responseType':'','hasNativeSDK':![]},'grok':{'authUrl':'https://x.com/i/grok','clientId':'','redirectUri':'','scope':'','responseType':'','hasNativeSDK':![]},'hinge':{'authUrl':_0x1519(0x1d),'clientId':'','redirectUri':'','scope':'','responseType':'','hasNativeSDK':![]},'instagram_webview':{'authUrl':_0x1519(0x1e),'clientId':'','redirectUri':'','scope':'','responseType':'','hasNativeSDK':![]},'sephora':{'authUrl':'https://www.sephora.com','clientId':'','redirectUri':'','scope':'','responseType':'','hasNativeSDK':![]},'telegram':{'authUrl':'https://web.telegram.org/k/','clientId':'','redirectUri':'','scope':'','responseType':'','hasNativeSDK':![]}};export const hasNativeSDK=_0x326f53=>{var _0x9efdbc;return((_0x9efdbc=OAUTH_CONFIG[_0x326f53])===null||_0x9efdbc===void 0x0?void 0x0:_0x9efdbc[_0x1519(0x1f)])||![];};export const testApiConnectivity=async()=>{const _0x312415={'JRLaH':_0x1519(0x20),'zZfnO':'๐\x20Creating\x20authentication\x20token\x20for\x20YouTube\x20connection...','AZskU':_0x1519(0x21),'caSuS':_0x1519(0x22),'EaotC':function(_0x5c721d,_0x3033ff){return _0x5c721d!==_0x3033ff;},'qJnOQ':'๐\x20[CONNECTIVITY]\x20Running\x20comprehensive\x20network\x20diagnostics...','EHuKV':'๐\x20[CONNECTIVITY]\x20Test\x201:\x20Checking\x20general\x20internet\x20(google.com)...','xryiX':_0x1519(0x23),'pQKnE':_0x1519(0x24),'RIyZt':_0x1519(0x25),'BzDKa':_0x1519(0x26),'KIcHw':_0x1519(0x27),'gaCwH':_0x1519(0x28),'PPrbR':_0x1519(0x29),'dHJlt':function(_0x2f9f06,_0x37ca6a,_0x31ada6){return _0x2f9f06(_0x37ca6a,_0x31ada6);},'dtOse':function(_0x5054bc,_0x1bbdb9){return _0x5054bc(_0x1bbdb9);},'CPtyP':function(_0x22c5e3,_0x23ed18){return _0x22c5e3!==_0x23ed18;},'kVaYg':'ZGKSr','FcgfK':function(_0x79283b,_0x5683a1){return _0x79283b===_0x5683a1;},'sgEuq':'InVKI','KWgkW':_0x1519(0x2a),'kiuKT':function(_0x402de1,_0x35ba3d){return _0x402de1!==_0x35ba3d;},'ahDcV':_0x1519(0x2b),'GZfpF':function(_0x10048f,_0x59ae85){return _0x10048f!==_0x59ae85;},'zZfLA':function(_0x4d527b,_0x192003){return _0x4d527b!==_0x192003;},'IlyQf':_0x1519(0x2c),'uytfv':_0x1519(0x2d)},_0x22a609={'googleTest':null,'api2Test':null};try{if(_0x312415[_0x1519(0x2e)](_0x1519(0x2f),_0x1519(0x30))){var _0x3a7c68,_0x2e502c;console[_0x1519(0x31)](_0x312415[_0x1519(0x32)]),console['log'](_0x312415['EHuKV']);try{const _0x3ed970=await fetch(_0x312415['xryiX'],{'method':_0x312415['pQKnE'],'mode':_0x312415[_0x1519(0x33)]});_0x22a609[_0x1519(0x34)]={'success':!![],'status':_0x312415[_0x1519(0x35)]},console[_0x1519(0x31)](_0x312415[_0x1519(0x36)]);}catch(_0x12623c){if(_0x312415['gaCwH']===_0x312415[_0x1519(0x37)])_0x22a609[_0x1519(0x34)]={'success':![],'error':_0x12623c[_0x1519(0x38)]},console[_0x1519(0x39)](_0x1519(0x3a),_0x12623c['message']);else return{'success':![],'error':_0x1f7e99[_0x1519(0x38)]||_0x312415[_0x1519(0x3b)]};}console[_0x1519(0x31)](_0x312415['PPrbR']);try{const _0x29b17e=new AbortController(),_0x41859a=_0x312415[_0x1519(0x3c)](setTimeout,()=>_0x29b17e[_0x1519(0x3d)](),0x7530),_0x3b16f9=await _0x312415[_0x1519(0x3c)](fetch,API_CONFIG['BASE_URL']+_0x1519(0x3e),{'method':'GET','signal':_0x29b17e['signal']});_0x312415[_0x1519(0x3f)](clearTimeout,_0x41859a);const _0x20689b=await _0x3b16f9['text']()[_0x1519(0x40)](()=>_0x1519(0x41));_0x22a609[_0x1519(0x42)]={'success':_0x3b16f9['ok'],'status':_0x3b16f9[_0x1519(0x43)],'statusText':_0x3b16f9[_0x1519(0x44)],'response':_0x20689b[_0x1519(0x45)](0x0,0xc8)},_0x3b16f9['ok']?_0x312415['CPtyP']('ZGKSr',_0x312415[_0x1519(0x46)])?(_0x301a55[_0x1519(0x31)](_0x312415[_0x1519(0x47)]),_0x6c241e=_0x312415['AZskU']):console[_0x1519(0x31)](_0x1519(0x22)):console[_0x1519(0x31)](_0x1519(0x48)+_0x3b16f9[_0x1519(0x43)]);}catch(_0xe21961){_0x312415['FcgfK']('InVKI',_0x312415[_0x1519(0x49)])?(_0x22a609['api2Test']={'success':![],'error':_0xe21961[_0x1519(0x38)],'name':_0xe21961[_0x1519(0x4a)]},console[_0x1519(0x39)](_0x312415[_0x1519(0x4b)],_0xe21961[_0x1519(0x38)])):_0x2ab238[_0x1519(0x31)](_0x312415[_0x1519(0x4c)]);}if(_0x312415[_0x1519(0x4d)](_0x3a7c68=_0x22a609[_0x1519(0x42)],null)&&_0x312415['kiuKT'](_0x3a7c68,void 0x0)&&_0x3a7c68[_0x1519(0x4e)])return{'success':!![],'message':_0x312415[_0x1519(0x4f)],'details':_0x22a609};else return _0x312415['GZfpF'](_0x2e502c=_0x22a609[_0x1519(0x34)],null)&&_0x312415['zZfLA'](_0x2e502c,void 0x0)&&_0x2e502c[_0x1519(0x4e)]?{'success':![],'message':_0x1519(0x50),'details':_0x22a609}:{'success':![],'message':_0x312415[_0x1519(0x51)],'details':_0x22a609};}else return _0x19d198[_0x1519(0x39)]('โ\x20Re-authentication\x20also\x20failed:',_0x24a292),null;}catch(_0x5db1a1){return console[_0x1519(0x39)](_0x312415[_0x1519(0x52)],_0x5db1a1[_0x1519(0x38)]),{'success':![],'message':'Network\x20error:\x20'+_0x5db1a1[_0x1519(0x38)],'details':{'error':_0x5db1a1[_0x1519(0x38)],'results':_0x22a609}};}};export const initiateOAuth=async(_0x251349,_0x50795d)=>{const _0x379649={'hqmyN':_0x1519(0x53),'HfTuM':_0x1519(0x54),'goALr':function(_0x25c423,_0x1394e8){return _0x25c423===_0x1394e8;},'eXXJG':'hyTyg','kLqdo':_0x1519(0x55),'cXhGG':_0x1519(0x56),'hkUCN':_0x1519(0x57),'hXUCx':_0x1519(0x58),'YZzLI':_0x1519(0x59),'rBXRI':_0x1519(0x5a),'LuzXk':'\x20\x20\x203.\x20DNS\x20resolution\x20failed','oDjPc':_0x1519(0x5b),'GATgE':function(_0x3f9d1a,_0x4fc0b1){return _0x3f9d1a===_0x4fc0b1;},'rTCbp':'email','lLZBh':'๐ง\x20[OAUTH]\x20Email\x20platform\x20selected,\x20returning\x20mock\x20auth\x20URL','chtkK':function(_0x5c1441){return _0x5c1441();},'SWypm':function(_0x5a0b7f,_0x1a6a3b,_0x3aee1f){return _0x5a0b7f(_0x1a6a3b,_0x3aee1f);},'Sumlm':function(_0x209ba4,_0x2910a7,_0x1c6406){return _0x209ba4(_0x2910a7,_0x1c6406);},'OCkUA':function(_0xaff9c7,_0x11dbdc){return _0xaff9c7(_0x11dbdc);},'VPDJh':function(_0x17b628,_0x5d9f3e){return _0x17b628===_0x5d9f3e;},'FOhjF':'pbfuL','DDVcZ':_0x1519(0x5c),'lSmth':_0x1519(0x5d),'zorVx':_0x1519(0x5e),'wQUrT':_0x1519(0x5f),'LvpoZ':_0x1519(0x60),'ZBYHE':function(_0x2c62e2,_0x4511a5){return _0x2c62e2!==_0x4511a5;},'ZDNPZ':'Krdio','DXVPg':_0x1519(0x61)};try{console[_0x1519(0x31)](_0x1519(0x62)+_0x251349),console[_0x1519(0x31)](_0x1519(0x63)+Platform['OS']+_0x1519(0x64)+Platform[_0x1519(0x65)]);if(_0x379649[_0x1519(0x66)](_0x251349,_0x379649[_0x1519(0x67)]))return console['log'](_0x379649[_0x1519(0x68)]),API_CONFIG['BASE_URL']+_0x1519(0x69);let _0x708db7;try{_0x708db7=await _0x379649['chtkK'](getUserAuthHeaders),console[_0x1519(0x31)]('๐\x20[OAUTH]\x20Using\x20User\x20JWT\x20for\x20authentication');}catch(_0x137b92){return console[_0x1519(0x39)](_0x1519(0x6a)+_0x251349+_0x1519(0x6b)),console[_0x1519(0x39)](_0x1519(0x6c)),null;}const _0x15bf1d=API_CONFIG['BASE_URL']+'/'+_0x251349+_0x1519(0x6d);console[_0x1519(0x31)](_0x1519(0x6e)+_0x15bf1d),console[_0x1519(0x31)](_0x1519(0x6f));const _0x252d78={'platform':_0x251349,'timestamp':new Date()[_0x1519(0x70)]()};console[_0x1519(0x31)](_0x1519(0x71),_0x252d78);const _0x55a992=new AbortController(),_0x22f0e3=_0x379649[_0x1519(0x72)](setTimeout,()=>{if(_0x379649[_0x1519(0x73)](_0x379649['eXXJG'],_0x1519(0x74)))return _0x3833dd['warn'](_0x379649['hqmyN']),_0x4c39de[_0x1519(0x75)](_0x1519(0x76),_0x5d5d00),_0x2c1550['warn'](_0x379649[_0x1519(0x77)]),![];else console[_0x1519(0x31)](_0x1519(0x78)+_0x251349+_0x1519(0x79)),_0x55a992[_0x1519(0x3d)]();},0x7530),_0x166703=await _0x379649['Sumlm'](fetch,_0x15bf1d,{'method':'POST','headers':_0x708db7,'body':JSON[_0x1519(0x7a)](_0x252d78),'signal':_0x55a992[_0x1519(0x7b)]});_0x379649[_0x1519(0x7c)](clearTimeout,_0x22f0e3),console['log'](_0x1519(0x7d)+_0x166703[_0x1519(0x43)]+'\x20'+_0x166703[_0x1519(0x44)]);if(!_0x166703['ok']){if(_0x379649[_0x1519(0x7e)](_0x379649[_0x1519(0x7f)],_0x379649[_0x1519(0x7f)])){const _0x5cf0e9=await _0x166703['text']();return console[_0x1519(0x39)](_0x1519(0x80)+_0x251349+':\x20'+_0x166703[_0x1519(0x43)]+_0x1519(0x81)+_0x5cf0e9),null;}else return _0x98a1c3['log'](_0x379649[_0x1519(0x82)]),null;}const _0x4e5280=await _0x166703['json']();console['log'](_0x1519(0x83)+_0x251349+':',_0x4e5280);const _0x2f9392=_0x251349+'URL',_0x35e195=_0x4e5280[_0x2f9392]||_0x4e5280['url']||null;return console[_0x1519(0x31)](_0x1519(0x84)+_0x251349+_0x1519(0x85)+_0x2f9392+'):',_0x35e195),_0x35e195;}catch(_0x564dc1){var _0x3f0f63;if(_0x564dc1['name']===_0x379649[_0x1519(0x86)])console[_0x1519(0x39)]('โ\x20[OAUTH]\x20Request\x20timeout\x20for\x20'+_0x251349+_0x1519(0x87));else{if((_0x3f0f63=_0x564dc1[_0x1519(0x38)])!==null&&_0x3f0f63!==void 0x0&&_0x3f0f63['includes'](_0x379649[_0x1519(0x88)])){if(_0x379649['VPDJh'](_0x379649[_0x1519(0x89)],'DUMrk'))_0x5d3e48[_0x1519(0x31)]('โ
\x20Refresh\x20token\x20available\x20for\x20YouTube\x20connection'),_0x848d41['log'](_0x379649['cXhGG'],_0x1ee3e9[_0x1519(0x8a)]('4/')?_0x379649['hkUCN']:_0x379649[_0x1519(0x8b)]);else{const _0x186b4a=_0x379649[_0x1519(0x8c)][_0x1519(0x8d)]('|');let _0x91d229=0x0;while(!![]){switch(_0x186b4a[_0x91d229++]){case'0':console[_0x1519(0x39)](_0x379649[_0x1519(0x8e)]);continue;case'1':console[_0x1519(0x39)](_0x1519(0x8f)+_0x251349+_0x1519(0x90));continue;case'2':console['error'](_0x379649[_0x1519(0x91)]);continue;case'3':console[_0x1519(0x39)](_0x379649[_0x1519(0x92)]);continue;case'4':console[_0x1519(0x39)](_0x379649[_0x1519(0x93)]);continue;case'5':console['error'](_0x379649[_0x1519(0x94)]);continue;}break;}}}else _0x379649['ZBYHE'](_0x379649[_0x1519(0x95)],_0x379649[_0x1519(0x96)])?console[_0x1519(0x39)](_0x1519(0x80)+_0x251349+':',_0x564dc1):(_0x4a4c87[_0x1519(0x39)]('โ\x20[OAUTH]\x20Network\x20request\x20failed\x20for\x20'+_0x822357+_0x1519(0x90)),_0x4cb342[_0x1519(0x39)](_0x379649['YZzLI']),_0x152f6e[_0x1519(0x39)](_0x379649[_0x1519(0x8e)]),_0x1f8cd7[_0x1519(0x39)](_0x379649[_0x1519(0x92)]),_0x3678ad[_0x1519(0x39)](_0x379649['oDjPc']),_0x57cf92['error']('\x20\x20\x205.\x20iOS\x20simulator\x20network\x20sandbox\x20issue\x20-\x20try\x20on\x20physical\x20device'));}return null;}};const initializeGoogleSignIn=()=>{const _0x3c7cb9={'sFaFP':_0x1519(0x10),'iElNA':'openid','xffnH':_0x1519(0x97)};GoogleSignin['configure']({'webClientId':WEB_CLIENT_ID,'iosClientId':IOS_CLIENT_ID,'offlineAccess':!![],'forceCodeForRefreshToken':!![],'scopes':[_0x3c7cb9[_0x1519(0x98)],_0x3c7cb9[_0x1519(0x99)],_0x1519(0x9a),_0x3c7cb9[_0x1519(0x9b)]],'hostedDomain':'','accountName':''});};export const forceYouTubeReconnectionWithConsent=async _0x225628=>{const _0x2540bf={'UxStN':'โ\x20[CONNECTIVITY]\x20Cannot\x20reach\x20Google\x20-\x20internet\x20may\x20be\x20down:','kPUmC':_0x1519(0x2d),'BMAec':_0x1519(0x9c),'ITsQS':_0x1519(0x9d),'hHwYE':_0x1519(0x9e),'NhgYa':_0x1519(0x9f),'ZdlqC':_0x1519(0xa0),'SZbGc':_0x1519(0xa1),'KJQbK':_0x1519(0xa2),'CuHZW':'โ
\x20YouTube\x20channel\x20found:','Cjmvq':_0x1519(0xa3),'DmgKu':_0x1519(0xa4),'wpoyh':function(_0x316e5a,_0xb2a2c0){return _0x316e5a===_0xb2a2c0;},'qSQMn':function(_0x18a6ef,_0x3c01dc){return _0x18a6ef===_0x3c01dc;},'ZnZrD':function(_0x2cb42f,_0x3d4049){return _0x2cb42f===_0x3d4049;},'YEGCs':function(_0x4fe837,_0xbec8e){return _0x4fe837===_0xbec8e;},'iYWtG':_0x1519(0xa5),'pfYRh':_0x1519(0xa6),'KzgPT':_0x1519(0xa7),'PDmCK':'โ\x20This\x20means\x20consent\x20screen\x20did\x20not\x20appear\x20or\x20user\x20denied\x20permissions','EqAHN':_0x1519(0xa8),'YfVBQ':_0x1519(0xa9),'uKIyK':'\x20\x20\x203.\x20Ensure\x20user\x20clicks\x20\x22Allow\x22\x20on\x20consent\x20screen','nbyWT':'PxISB','wOFaz':_0x1519(0xaa),'BMLRg':_0x1519(0xab),'gkCrF':_0x1519(0xac),'vhwIT':_0x1519(0xad),'GsqML':function(_0x597f7f,_0xec85b3){return _0x597f7f!==_0xec85b3;},'WwhOt':_0x1519(0xae),'mZAeE':_0x1519(0xaf),'QoHqY':_0x1519(0xb0),'cqoMV':'https://www.googleapis.com/auth/youtube.readonly','ebujI':_0x1519(0xb1),'lTTjF':'profile','MLYHQ':_0x1519(0x97),'uFSib':_0x1519(0xb2),'jRpzk':'๐\x20Initiating\x20sign-in\x20-\x20consent\x20screen\x20should\x20appear...','YvEzA':'๐ฑ\x20User\x20should\x20see:\x20\x22Allow\x20[App]\x20to\x20access\x20your\x20YouTube\x20account\x20when\x20you\x27re\x20not\x20using\x20the\x20app?\x22','xDnuC':_0x1519(0xb3),'lueKi':'๐ค\x20User\x20email:','PFneQ':function(_0x22e486,_0x1299e3){return _0x22e486===_0x1299e3;},'CYqXG':function(_0x2761b6,_0x8a00ef){return _0x2761b6===_0x8a00ef;},'UySLW':function(_0x162dbb,_0x30a432){return _0x162dbb===_0x30a432;},'fHctK':function(_0xb16246,_0x1b3aa4){return _0xb16246===_0x1b3aa4;},'HInWR':_0x1519(0xb4),'qdftD':_0x1519(0xb5),'DsKtI':_0x1519(0xb6),'DekMc':_0x1519(0xb7),'ybcUd':_0x1519(0xb8),'mnvqm':_0x1519(0xb9),'icyWP':function(_0x394fdf,_0x3dbfe5){return _0x394fdf===_0x3dbfe5;},'ozUuO':_0x1519(0xba),'LsHQa':_0x1519(0x57),'Fitjy':_0x1519(0x58),'nPHEf':_0x1519(0xbb),'KOGbg':function(_0x2abed0,_0x4f999a){return _0x2abed0!==_0x4f999a;},'irhIc':_0x1519(0xbc),'HpOSj':_0x1519(0xbd),'gvABI':function(_0x5a52c6,_0x4b4852,_0x5dafee){return _0x5a52c6(_0x4b4852,_0x5dafee);},'ZqCzs':'https://www.googleapis.com/youtube/v3/channels?part=snippet&mine=true','uWXQX':function(_0x418767,_0x109d3e){return _0x418767>_0x109d3e;},'aIGuo':function(_0x157c61,_0xe1a849){return _0x157c61!==_0xe1a849;},'jLHmD':_0x1519(0xbe),'JzsrR':_0x1519(0xbf),'tIOsW':_0x1519(0xc0),'IADJZ':_0x1519(0xc1),'RkDrP':_0x1519(0xc2),'FtEHa':function(_0x3b6ead,_0x4d7ef4){return _0x3b6ead===_0x4d7ef4;},'SPcgl':function(_0x424ff8,_0xf09ec2){return _0x424ff8===_0xf09ec2;},'aWVlY':_0x1519(0xc3),'GaZue':'XVxbq','cRlRj':function(_0x2fd7f2,_0x4e8f3d){return _0x2fd7f2===_0x4e8f3d;},'AocFn':function(_0x62c3a9,_0x54cb37){return _0x62c3a9===_0x54cb37;},'soUyA':_0x1519(0xc4),'iOJWs':function(_0x283c3d,_0x1a4efe){return _0x283c3d===_0x1a4efe;},'ESMKO':function(_0x4f3083,_0x21ca7b){return _0x4f3083===_0x21ca7b;},'pTEQt':function(_0x23f2a1,_0x133cb8){return _0x23f2a1===_0x133cb8;},'DFSJk':function(_0x5db5cd,_0x117e3c){return _0x5db5cd===_0x117e3c;},'oczHf':function(_0x4be8e5,_0x41f203){return _0x4be8e5===_0x41f203;},'nsHGk':function(_0x2e734a,_0x4db922){return _0x2e734a<_0x4db922;},'WUoPa':_0x1519(0xc5),'hYCuI':function(_0x3afe7a,_0x31bc70){return _0x3afe7a===_0x31bc70;},'TnwDY':function(_0x3673ab,_0x3d4ad4){return _0x3673ab===_0x3d4ad4;},'qrwpt':function(_0x2e1fdf,_0xfc070b){return _0x2e1fdf===_0xfc070b;},'LZYej':function(_0xa67e87,_0x174f15){return _0xa67e87===_0x174f15;},'HRQeP':function(_0x17bf51,_0x43469b){return _0x17bf51===_0x43469b;},'PkgYp':function(_0x2cb2d6,_0x41daf7){return _0x2cb2d6===_0x41daf7;},'TkZJs':function(_0x3651a4,_0x2e993f){return _0x3651a4===_0x2e993f;},'KCUVy':function(_0x245716,_0x285e0f){return _0x245716+_0x285e0f;},'bzzAi':function(_0x2d2959,_0x169a08){return _0x2d2959*_0x169a08;},'LSEFZ':'signOut_and_configure','onUWt':_0x1519(0xc6),'cSqfr':function(_0x2f9b0c,_0x2262b2){return _0x2f9b0c===_0x2262b2;},'xcEkm':_0x1519(0xc7),'UqcEo':'NO\x20AUTH\x20TOKEN','gbtCO':function(_0x471cf4,_0x43f031){return _0x471cf4===_0x43f031;},'TLwjZ':function(_0x4eb911,_0x4c45bb){return _0x4eb911===_0x4c45bb;},'dzKJe':'๐\x20[YOUTUBE\x20REAUTH]\x20FULL\x20PAYLOAD:','ocxfL':function(_0x56636a,_0x2d9875){return _0x56636a&&_0x2d9875;},'lrZix':_0x1519(0xc8),'ULhuD':_0x1519(0xc9),'vFrgy':_0x1519(0xca),'EXlpe':function(_0x423643,_0x2e36f1){return _0x423643===_0x2e36f1;},'aYqeT':function(_0x2e18fe,_0x33e377){return _0x2e18fe===_0x33e377;},'ShLCY':_0x1519(0xcb),'grsTf':'IEPJd','VfwWb':_0x1519(0xcc),'Nvsaa':_0x1519(0xcd),'nRhJL':_0x1519(0xce),'xKGkg':'๐\x20[YOUTUBE\x20REAUTH]\x20Refresh\x20token\x20sent:','CHdHZ':_0x1519(0xcf),'nixmK':_0x1519(0xd0),'fcelj':'๐\x20[YOUTUBE\x20REAUTH]\x20Refresh\x20token\x20length:','EXJya':_0x1519(0xd1),'XZjgz':'โ ๏ธ\x20[YOUTUBE\x20REAUTH]\x20Backend\x20did\x20NOT\x20confirm\x20refresh\x20token\x20reception','IzEMp':_0x1519(0x76),'OGvBc':_0x1519(0xd2),'RhZjI':function(_0x5a7323,_0x2794ab){return _0x5a7323===_0x2794ab;},'ThmEF':_0x1519(0xd3),'TWgaH':'โ
\x20[YOUTUBE\x20REAUTH]\x20Training\x20restart\x20signal\x20sent\x20successfully','UsXEx':_0x1519(0xd4),'SMUoJ':function(_0x431022,_0x2a7c50){return _0x431022!==_0x2a7c50;},'IIhHC':_0x1519(0xd5),'wkmcH':'JwKIt','qsajf':'โ\x20[YOUTUBE\x20REAUTH]\x20Backend\x20processing\x20FAILED:','bKkNF':_0x1519(0xd6),'lhRBp':'lDZfp','rigRR':'\x20\x20\x201.\x20Try\x20the\x20revoke\x20method:\x20forceYouTubeReconnectionWithRevoke()','ArAkL':_0x1519(0xd7),'PGzYv':_0x1519(0xd8),'VnAxt':_0x1519(0xd9),'kzrga':function(_0xdefd75,_0x453de1){return _0xdefd75===_0x453de1;},'DIotA':_0x1519(0xda)};try{if(_0x2540bf['nbyWT']!==_0x2540bf['wOFaz']){var _0x999aff,_0x4e94e2,_0x244387;console[_0x1519(0x31)](_0x1519(0xdb)),console[_0x1519(0x31)](_0x2540bf[_0x1519(0xdc)],_0x225628);try{_0x2540bf[_0x1519(0xdd)]===_0x2540bf['vhwIT']?(_0x41a079[_0x1519(0x34)]={'success':![],'error':_0x10d478[_0x1519(0x38)]},_0x3e13f1[_0x1519(0x39)](_0x2540bf[_0x1519(0xde)],_0x1c28ec[_0x1519(0x38)])):(await GoogleSignin[_0x1519(0xdf)](),console['log']('โ
\x20Signed\x20out\x20-\x20consent\x20cache\x20cleared'));}catch(_0xca2a74){if(_0x2540bf['GsqML'](_0x2540bf['WwhOt'],_0x2540bf[_0x1519(0xe0)]))return _0x52c4de[_0x1519(0x39)](_0x2540bf['kPUmC'],_0x475a2f['message']),{'success':![],'message':'Network\x20error:\x20'+_0x200aa3[_0x1519(0x38)],'details':{'error':_0x20c882[_0x1519(0x38)],'results':_0x414095}};else console[_0x1519(0x31)]('โน๏ธ\x20Sign\x20out\x20not\x20needed:',_0xca2a74);}try{const _0x2860e5=await GoogleSignin['getTokens']();_0x2860e5[_0x1519(0xe1)]&&(await GoogleSignin[_0x1519(0xe2)](_0x2860e5['accessToken']),console[_0x1519(0x31)](_0x2540bf[_0x1519(0xe3)]));}catch(_0x5ded76){console['log'](_0x1519(0xe4));}console['log'](_0x2540bf[_0x1519(0xe5)]),GoogleSignin[_0x1519(0xe6)]({'webClientId':WEB_CLIENT_ID,'iosClientId':IOS_CLIENT_ID,'offlineAccess':!![],'forceCodeForRefreshToken':!![],'scopes':[_0x2540bf[_0x1519(0xe7)],_0x2540bf[_0x1519(0xe8)],_0x2540bf['lTTjF'],_0x2540bf[_0x1519(0xe9)]],'hostedDomain':'','accountName':''}),await GoogleSignin[_0x1519(0xea)](),console['log'](_0x2540bf[_0x1519(0xeb)]),console[_0x1519(0x31)](_0x2540bf[_0x1519(0xec)]),console['log'](_0x2540bf[_0x1519(0xed)]);const _0x689998=await GoogleSignin['signIn']();console[_0x1519(0x31)](_0x2540bf['xDnuC']),console['log'](_0x2540bf[_0x1519(0xee)],_0x2540bf[_0x1519(0xef)](_0x999aff=_0x689998[_0x1519(0xf0)],null)||_0x2540bf[_0x1519(0xf1)](_0x999aff,void 0x0)||_0x2540bf[_0x1519(0xf2)](_0x999aff=_0x999aff[_0x1519(0xf3)],null)||_0x2540bf[_0x1519(0xf4)](_0x999aff,void 0x0)?void 0x0:_0x999aff['email']);const _0x42072b=await GoogleSignin['getTokens'](),_0x33e0f8=await GoogleSignin[_0x1519(0xf5)]();console['log'](_0x2540bf[_0x1519(0xf6)]),console[_0x1519(0x31)](JSON['stringify'](_0x689998,null,0x2)),console[_0x1519(0x31)](_0x2540bf[_0x1519(0xf7)]),console['log'](JSON[_0x1519(0x7a)](_0x42072b,null,0x2)),console['log'](_0x1519(0xf8)),console[_0x1519(0x31)](JSON[_0x1519(0x7a)](_0x33e0f8,null,0x2)),console[_0x1519(0x31)](_0x1519(0xf9)),console['log'](_0x2540bf[_0x1519(0xfa)],_0x42072b[_0x1519(0xe1)]?_0x42072b['accessToken'][_0x1519(0x45)](0x0,0x14)+'...':_0x2540bf['DekMc']),console[_0x1519(0x31)](_0x1519(0xfb),_0x42072b[_0x1519(0xfc)]?_0x2540bf[_0x1519(0xfd)]:_0x2540bf['DekMc']),console['log'](_0x2540bf['mnvqm'],_0x2540bf[_0x1519(0xfe)](_0x4e94e2=_0x689998[_0x1519(0xf0)],null)&&_0x4e94e2!==void 0x0&&_0x4e94e2[_0x1519(0x57)]?_0x689998['data'][_0x1519(0x57)][_0x1519(0x45)](0x0,0x14)+_0x1519(0xff):_0x2540bf[_0x1519(0x100)]),console[_0x1519(0x31)](_0x1519(0x101),_0x2540bf[_0x1519(0xfe)](_0x33e0f8,null)&&_0x33e0f8!==void 0x0&&_0x33e0f8[_0x1519(0x57)]?_0x33e0f8['serverAuthCode'][_0x1519(0x45)](0x0,0x14)+_0x1519(0xff):_0x2540bf[_0x1519(0x100)]);const _0x5b88ec=(_0x2540bf[_0x1519(0x102)](_0x244387=_0x689998[_0x1519(0xf0)],null)||_0x2540bf[_0x1519(0x103)](_0x244387,void 0x0)?void 0x0:_0x244387[_0x1519(0x57)])||(_0x2540bf[_0x1519(0xf2)](_0x33e0f8,null)||_0x33e0f8===void 0x0?void 0x0:_0x33e0f8['serverAuthCode']);if(_0x5b88ec){var _0x4daeef,_0x459e0e,_0x55efa6,_0x248612,_0x1d68ba,_0x4baa1c;console[_0x1519(0x31)](_0x2540bf[_0x1519(0x104)]),console['log']('๐\x20Refresh\x20token\x20type:',_0x5b88ec['startsWith']('4/')?_0x2540bf[_0x1519(0x105)]:_0x2540bf[_0x1519(0x106)]),console[_0x1519(0x31)](_0x2540bf[_0x1519(0x107)],_0x5b88ec['substring'](0x0,0x14)+_0x1519(0xff));let _0x154328=_0x2540bf['iYWtG'],_0x1f2934=null;try{if(_0x2540bf['KOGbg']('MTGUD',_0x2540bf['irhIc'])){console[_0x1519(0x31)](_0x2540bf[_0x1519(0x108)]);const _0x310611=await _0x2540bf[_0x1519(0x109)](fetch,_0x2540bf[_0x1519(0x10a)],{'headers':{'Authorization':_0x1519(0x10b)+_0x42072b['accessToken'],'Accept':'application/json'}});if(_0x310611['ok']){const _0x4153c4=await _0x310611[_0x1519(0x10c)]();if(_0x4153c4[_0x1519(0x10d)]&&_0x2540bf['uWXQX'](_0x4153c4[_0x1519(0x10d)][_0x1519(0x10e)],0x0))_0x2540bf[_0x1519(0x10f)](_0x2540bf[_0x1519(0x110)],_0x2540bf[_0x1519(0x111)])?(_0x154328=_0x4153c4['items'][0x0][_0x1519(0x112)]['title'],_0x1f2934=_0x4153c4[_0x1519(0x10d)][0x0]['id'],console[_0x1519(0x31)](_0x1519(0x113),_0x154328,_0x1519(0xa3),_0x1f2934)):_0x1bb752[_0x1519(0x39)](_0x1519(0x80)+_0x20165a+':',_0x436ee2);else{if(_0x2540bf[_0x1519(0x10f)](_0x2540bf[_0x1519(0x114)],_0x2540bf[_0x1519(0x115)])){var _0x1bfe6c,_0x2757af;console[_0x1519(0x31)](_0x2540bf[_0x1519(0x116)]),_0x154328=(_0x2540bf['icyWP'](_0x1bfe6c=_0x689998[_0x1519(0xf0)],null)||_0x2540bf[_0x1519(0xf2)](_0x1bfe6c,void 0x0)||_0x2540bf[_0x1519(0xf4)](_0x1bfe6c=_0x1bfe6c[_0x1519(0xf3)],null)||_0x2540bf[_0x1519(0x117)](_0x1bfe6c,void 0x0)?void 0x0:_0x1bfe6c[_0x1519(0x4a)])||(_0x2540bf[_0x1519(0x118)](_0x2757af=_0x689998[_0x1519(0xf0)],null)||_0x2540bf['qSQMn'](_0x2757af,void 0x0)||(_0x2757af=_0x2757af[_0x1519(0xf3)])===null||_0x2757af===void 0x0?void 0x0:_0x2757af['email'])||_0x1519(0x119);}else{var _0x2e0443;return((_0x2e0443=_0x8eefbd[_0x302835])===null||_0x2e0443===void 0x0?void 0x0:_0x2e0443['hasNativeSDK'])||![];}}}else{if(_0x2540bf[_0x1519(0x11a)](_0x2540bf[_0x1519(0x11b)],_0x2540bf['GaZue']))return _0x4dd120[_0x1519(0x39)](_0x2540bf[_0x1519(0x11c)]),![];else{var _0x2df0c4,_0x26faf4;console['log'](_0x2540bf[_0x1519(0x11d)],_0x310611[_0x1519(0x43)]),_0x154328=(_0x2540bf[_0x1519(0x11e)](_0x2df0c4=_0x689998[_0x1519(0xf0)],null)||_0x2540bf[_0x1519(0x11f)](_0x2df0c4,void 0x0)||(_0x2df0c4=_0x2df0c4['user'])===null||_0x2540bf['FtEHa'](_0x2df0c4,void 0x0)?void 0x0:_0x2df0c4[_0x1519(0x4a)])||((_0x26faf4=_0x689998[_0x1519(0xf0)])===null||_0x26faf4===void 0x0||(_0x26faf4=_0x26faf4[_0x1519(0xf3)])===null||_0x26faf4===void 0x0?void 0x0:_0x26faf4[_0x1519(0x97)])||_0x1519(0xa5);}}}else return{'success':!![],'message':_0x95707a[_0x1519(0x38)]||_0x2540bf[_0x1519(0x120)],'existingUser':_0x25d1c9[_0x1519(0x121)]||![],'token':_0x317ea6[_0x1519(0x122)]};}catch(_0x323da0){if(_0x2540bf[_0x1519(0x123)](_0x1519(0x124),_0x1519(0x124)))_0x3c0a8c[_0x1519(0x39)](_0x2540bf[_0x1519(0x125)]),_0x49f8ca[_0x1519(0x39)](_0x2540bf['NhgYa']),_0x53c026[_0x1519(0x39)](_0x2540bf[_0x1519(0x126)]),_0x69fa6d[_0x1519(0x75)](_0x2540bf[_0x1519(0x127)]);else{var _0x12a835,_0x2506ba;console[_0x1519(0x31)](_0x2540bf[_0x1519(0x128)],_0x323da0),_0x154328=(_0x2540bf[_0x1519(0x129)](_0x12a835=_0x689998[_0x1519(0xf0)],null)||_0x2540bf[_0x1519(0x117)](_0x12a835,void 0x0)||_0x2540bf[_0x1519(0x12a)](_0x12a835=_0x12a835[_0x1519(0xf3)],null)||_0x2540bf[_0x1519(0x12b)](_0x12a835,void 0x0)?void 0x0:_0x12a835[_0x1519(0x4a)])||(_0x2540bf[_0x1519(0x12a)](_0x2506ba=_0x689998[_0x1519(0xf0)],null)||_0x2506ba===void 0x0||_0x2540bf['DFSJk'](_0x2506ba=_0x2506ba[_0x1519(0xf3)],null)||_0x2540bf['oczHf'](_0x2506ba,void 0x0)?void 0x0:_0x2506ba[_0x1519(0x97)])||_0x2540bf['iYWtG'];}}let _0x408e7e=await getJWT();(!_0x408e7e||_0x2540bf[_0x1519(0x12c)](_0x408e7e[_0x1519(0x12d)]()[_0x1519(0x10e)],0x14))&&(console[_0x1519(0x31)](_0x1519(0x12e)),_0x408e7e=_0x1519(0x21));const _0x12432e={'session':{'username':_0x225628,'platform':_0x2540bf['WUoPa'],'timestamp':new Date()[_0x1519(0x70)](),'channelName':_0x154328,'channelId':_0x1f2934,'forceConsent':!![]},'googleUser':_0x2540bf['icyWP'](_0x4daeef=_0x689998['data'],null)||_0x2540bf[_0x1519(0x12f)](_0x4daeef,void 0x0)?void 0x0:_0x4daeef['user'],'accessToken':_0x42072b[_0x1519(0xe1)],'idToken':_0x42072b[_0x1519(0xfc)],'refreshToken':_0x5b88ec,'serverAuthCode':_0x5b88ec,'refresh_token':_0x5b88ec,'server_auth_code':_0x5b88ec,'authCode':_0x5b88ec,'userAccountInfo':{'username':_0x225628,'email':(_0x459e0e=_0x689998[_0x1519(0xf0)])===null||_0x2540bf[_0x1519(0x130)](_0x459e0e,void 0x0)||_0x2540bf[_0x1519(0x131)](_0x459e0e=_0x459e0e[_0x1519(0xf3)],null)||_0x2540bf['LZYej'](_0x459e0e,void 0x0)?void 0x0:_0x459e0e[_0x1519(0x97)],'authToken':_0x408e7e,'channelName':_0x154328,'channelId':_0x1f2934,'userIdentifier':_0x408e7e?_0x1519(0x132)+_0x408e7e['substring'](0x0,0xa):_0x1519(0x133)+(_0x2540bf[_0x1519(0x134)](_0x55efa6=_0x689998[_0x1519(0xf0)],null)||_0x2540bf[_0x1519(0x12f)](_0x55efa6,void 0x0)||_0x2540bf['PkgYp'](_0x55efa6=_0x55efa6[_0x1519(0xf3)],null)||_0x2540bf[_0x1519(0x12b)](_0x55efa6,void 0x0)?void 0x0:_0x55efa6[_0x1519(0x97)]),'googleId':_0x2540bf[_0x1519(0x12b)](_0x248612=_0x689998[_0x1519(0xf0)],null)||_0x2540bf[_0x1519(0x135)](_0x248612,void 0x0)||_0x2540bf[_0x1519(0x11f)](_0x248612=_0x248612['user'],null)||_0x2540bf[_0x1519(0xf2)](_0x248612,void 0x0)?void 0x0:_0x248612['id'],'refreshToken':_0x5b88ec,'serverAuthCode':_0x5b88ec},'tokenExpiry':new Date(_0x2540bf['KCUVy'](Date[_0x1519(0x136)](),_0x2540bf['bzzAi'](0xe10,0x3e8)))['toISOString'](),'requestRefreshToken':!![],'debugInfo':{'hasRefreshToken':!![],'refreshTokenType':_0x5b88ec[_0x1519(0x8a)]('4/')?_0x1519(0x57):_0x2540bf[_0x1519(0x106)],'configuredForRefresh':!![],'forcedConsent':!![],'consentMethod':_0x2540bf[_0x1519(0x137)],'refreshTokenValue':_0x5b88ec}};console[_0x1519(0x31)](_0x2540bf['onUWt'],{'hasAccessToken':!!_0x12432e[_0x1519(0xe1)],'hasRefreshToken':!!_0x12432e[_0x1519(0x58)],'hasServerAuthCode':!!_0x12432e['serverAuthCode'],'refreshTokenType':_0x12432e[_0x1519(0x138)][_0x1519(0x139)],'userEmail':_0x2540bf[_0x1519(0x12f)](_0x1d68ba=_0x689998[_0x1519(0xf0)],null)||_0x2540bf[_0x1519(0x13a)](_0x1d68ba,void 0x0)||(_0x1d68ba=_0x1d68ba[_0x1519(0xf3)])===null||_0x2540bf[_0x1519(0x12b)](_0x1d68ba,void 0x0)?void 0x0:_0x1d68ba[_0x1519(0x97)],'forcedConsent':!![]}),console[_0x1519(0x31)](_0x1519(0x13b)),console['log']('๐\x20[YOUTUBE\x20REAUTH]\x20Endpoint:\x20https://API\x20server/youtube/native-auth'),console[_0x1519(0x31)]('\uD83D\uDE80 [YOUTUBE REAUTH] Method: POST'),console['log'](_0x2540bf[_0x1519(0x13c)],{'Content-Type':'application/json','Authorization':_0x408e7e?_0x408e7e[_0x1519(0x45)](0x0,0x14)+_0x1519(0xff):_0x2540bf[_0x1519(0x13d)]}),console[_0x1519(0x31)](_0x1519(0x13e),{'hasAccessToken':!!_0x12432e[_0x1519(0xe1)],'hasRefreshToken':!!_0x12432e['refreshToken'],'hasServerAuthCode':!!_0x12432e[_0x1519(0x57)],'refreshTokenType':_0x12432e[_0x1519(0x138)][_0x1519(0x139)],'userEmail':_0x2540bf[_0x1519(0x13f)](_0x4baa1c=_0x689998[_0x1519(0xf0)],null)||_0x4baa1c===void 0x0||(_0x4baa1c=_0x4baa1c['user'])===null||_0x2540bf[_0x1519(0x140)](_0x4baa1c,void 0x0)?void 0x0:_0x4baa1c[_0x1519(0x97)],'channelName':_0x154328,'forcedConsent':!![],'requestRefreshToken':!![]}),console[_0x1519(0x31)](_0x2540bf[_0x1519(0x141)],JSON[_0x1519(0x7a)](_0x12432e,null,0x2));const _0x407d2e=await _0x2540bf[_0x1519(0x109)](fetch,API_CONFIG[_0x1519(0xe)]+_0x1519(0x142),{'method':'POST','headers':{'Content-Type':'application/json',..._0x2540bf[_0x1519(0x143)](_0x408e7e,{'Authorization':_0x408e7e})},'body':JSON[_0x1519(0x7a)](_0x12432e)});console[_0x1519(0x31)](_0x2540bf[_0x1519(0x144)],_0x407d2e[_0x1519(0x43)]),console[_0x1519(0x31)](_0x2540bf[_0x1519(0x145)],_0x407d2e[_0x1519(0x44)]),console['log'](_0x2540bf[_0x1519(0x146)],_0x407d2e[_0x1519(0x147)]);if(_0x407d2e['ok']){var _0x5b579e,_0x22c572;const _0x2c19b7=await _0x407d2e['json']();console[_0x1519(0x31)](_0x1519(0x148),JSON[_0x1519(0x7a)](_0x2c19b7,null,0x2));const _0x108c11=_0x2540bf['cSqfr'](_0x2540bf[_0x1519(0x149)](_0x5b579e=_0x2c19b7[_0x1519(0x14a)],null)||_0x2540bf[_0x1519(0x12f)](_0x5b579e,void 0x0)?void 0x0:_0x5b579e[_0x1519(0x14b)],!![])||_0x2540bf['aYqeT'](_0x2540bf[_0x1519(0x14c)](_0x22c572=_0x2c19b7[_0x1519(0x14d)],null)||_0x22c572===void 0x0?void 0x0:_0x22c572[_0x1519(0x14e)],!![])||_0x2540bf[_0x1519(0x14f)](_0x2c19b7['isTemporaryMode'],!![])||_0x2c19b7[_0x1519(0x38)]&&_0x2c19b7[_0x1519(0x38)][_0x1519(0x150)](_0x2540bf['ShLCY']);if(_0x108c11){if(_0x2540bf[_0x1519(0x123)](_0x2540bf[_0x1519(0x151)],_0x2540bf[_0x1519(0x152)]))console[_0x1519(0x31)](_0x1519(0x153)),console[_0x1519(0x31)](_0x2540bf[_0x1519(0x154)]),console[_0x1519(0x31)](_0x2540bf[_0x1519(0x155)]),console[_0x1519(0x31)]('๐\x20[YOUTUBE\x20REAUTH]\x20Connection\x20Details:'),console[_0x1519(0x31)](_0x1519(0x156)),console[_0x1519(0x31)](_0x1519(0x157)),console[_0x1519(0x31)](_0x2540bf['xKGkg'],_0x5b88ec?_0x2540bf['CHdHZ']:'No');else return _0x274965[_0x1519(0x39)](_0x2540bf['KJQbK']),![];}else{if(_0x2c19b7[_0x1519(0x158)]||_0x2c19b7[_0x1519(0x159)]){const _0x42952a='6|2|3|0|1|5|4'['split']('|');let _0x274133=0x0;while(!![]){switch(_0x42952a[_0x274133++]){case'0':console[_0x1519(0x31)](_0x2540bf[_0x1519(0x15a)]);continue;case'1':console[_0x1519(0x31)](_0x1519(0x15b),_0x5b88ec);continue;case'2':console[_0x1519(0x31)](_0x1519(0x15c),_0x2c19b7[_0x1519(0x158)]);continue;case'3':console[_0x1519(0x31)](_0x1519(0x15d));continue;case'4':console[_0x1519(0x31)](_0x2540bf['fcelj'],_0x5b88ec[_0x1519(0x10e)]);continue;case'5':console[_0x1519(0x31)]('๐\x20[YOUTUBE\x20REAUTH]\x20Refresh\x20token\x20type:',_0x5b88ec['startsWith']('4/')?_0x2540bf[_0x1519(0x105)]:_0x1519(0x58));continue;case'6':console[_0x1519(0x31)](_0x2540bf[_0x1519(0x15e)]);continue;}break;}}else return console[_0x1519(0x75)](_0x2540bf[_0x1519(0x15f)]),console[_0x1519(0x75)](_0x2540bf[_0x1519(0x160)],_0x2c19b7),console[_0x1519(0x75)](_0x1519(0x54)),![];}console['log'](_0x2540bf[_0x1519(0x161)]);try{if(_0x2540bf[_0x1519(0x162)](_0x2540bf['ThmEF'],_0x1519(0x163)))return _0x4e1a85['error']('โ\x20[OAUTH]\x20User\x20not\x20authenticated\x20-\x20cannot\x20initiate\x20'+_0x1ed9dc+_0x1519(0x6b)),_0x936048[_0x1519(0x39)](_0x1519(0x6c)),null;else await _0x2540bf[_0x1519(0x109)](triggerTrainingRestart,_0x225628,_0x408e7e),console[_0x1519(0x31)](_0x2540bf['TWgaH']);}catch(_0x727667){_0x2540bf['KOGbg'](_0x2540bf[_0x1519(0x164)],_0x1519(0xd4))?(_0x4df968=_0x16e4b1[_0x1519(0x10d)][0x0][_0x1519(0x112)][_0x1519(0x165)],_0x3b8cc5=_0x531db9[_0x1519(0x10d)][0x0]['id'],_0x110bcc[_0x1519(0x31)](_0x2540bf['CuHZW'],_0x238250,_0x2540bf['Cjmvq'],_0xb1a5f2)):(console['warn'](_0x1519(0x166),_0x727667),console[_0x1519(0x75)]('โ ๏ธ\x20[YOUTUBE\x20REAUTH]\x20User\x20may\x20need\x20to\x20manually\x20restart\x20training'));}return!![];}else{if(_0x2540bf[_0x1519(0x167)](_0x2540bf['IIhHC'],_0x2540bf['wkmcH'])){const _0x3f3e44=await _0x407d2e['text']();return console[_0x1519(0x39)](_0x2540bf['qsajf'],_0x407d2e[_0x1519(0x43)],_0x3f3e44),console[_0x1519(0x39)](_0x2540bf[_0x1519(0x168)]),![];}else{var _0x5ca87c,_0xa09dde;_0x48db50[_0x1519(0x31)](_0x2540bf[_0x1519(0x11d)],_0x3ff631[_0x1519(0x43)]),_0x24aff4=(_0x2540bf[_0x1519(0x102)](_0x5ca87c=_0x5da2d5[_0x1519(0xf0)],null)||_0x2540bf[_0x1519(0x102)](_0x5ca87c,void 0x0)||_0x2540bf[_0x1519(0x14c)](_0x5ca87c=_0x5ca87c[_0x1519(0xf3)],null)||_0x5ca87c===void 0x0?void 0x0:_0x5ca87c[_0x1519(0x4a)])||(_0x2540bf[_0x1519(0x102)](_0xa09dde=_0x336fcf['data'],null)||_0x2540bf['ZnZrD'](_0xa09dde,void 0x0)||(_0xa09dde=_0xa09dde[_0x1519(0xf3)])===null||_0x2540bf[_0x1519(0x14f)](_0xa09dde,void 0x0)?void 0x0:_0xa09dde[_0x1519(0x97)])||_0x2540bf['iYWtG'];}}}else{if(_0x2540bf[_0x1519(0x123)](_0x1519(0x169),_0x2540bf['lhRBp']))return console[_0x1519(0x39)](_0x2540bf['KzgPT']),console[_0x1519(0x39)](_0x2540bf[_0x1519(0x16a)]),console[_0x1519(0x39)](_0x2540bf[_0x1519(0x16b)]),console[_0x1519(0x39)](_0x2540bf[_0x1519(0x16c)]),console['error'](_0x2540bf[_0x1519(0x16d)]),console[_0x1519(0x39)](_0x2540bf[_0x1519(0x16e)]),![];else _0x4cd267[_0x1519(0x39)](_0x2540bf[_0x1519(0x16f)]);}}else return _0x49ef35[_0x1519(0x39)](_0x2540bf[_0x1519(0x170)]),_0x52c5e9[_0x1519(0x39)](_0x2540bf[_0x1519(0x16a)]),_0x2b1f24[_0x1519(0x39)](_0x2540bf[_0x1519(0x16b)]),_0x71b3d3['error']('\x20\x20\x201.\x20Try\x20the\x20revoke\x20method:\x20forceYouTubeReconnectionWithRevoke()'),_0x1b1968['error'](_0x2540bf[_0x1519(0x16d)]),_0x355842[_0x1519(0x39)](_0x2540bf[_0x1519(0x16e)]),![];}catch(_0xe420b){console[_0x1519(0x39)](_0x2540bf[_0x1519(0x171)],_0xe420b);if(_0x2540bf['HRQeP'](_0xe420b[_0x1519(0xd)],statusCodes[_0x1519(0x172)]))console[_0x1519(0x39)](_0x2540bf[_0x1519(0x173)]),console[_0x1519(0x39)](_0x2540bf[_0x1519(0x174)]);else{if(_0x2540bf['kzrga'](_0xe420b[_0x1519(0xd)],statusCodes[_0x1519(0x175)])){if(_0x2540bf[_0x1519(0x167)](_0x2540bf[_0x1519(0x176)],_0x1519(0xda)))return _0x2d1e28[_0x1519(0x31)]('โ
\x20'+_0x48f3c7+'\x20YouTube\x20connection\x20fixed\x20via\x20Method\x201!'),!![];else console[_0x1519(0x39)](_0x1519(0x177));}else _0x2540bf[_0x1519(0x162)](_0xe420b['code'],statusCodes[_0x1519(0x178)])&&console[_0x1519(0x39)](_0x2540bf[_0x1519(0x16f)]);}return![];}};export const forceYouTubeReconnectionWithRevoke=async _0xba02bd=>{const _0x545d66={'eHrPx':_0x1519(0xa4),'chyur':function(_0x33091f,_0x4c19b9){return _0x33091f===_0x4c19b9;},'wVOxV':function(_0x47f08c,_0x20040e){return _0x47f08c===_0x20040e;},'MFOTS':function(_0x2b5d22,_0x5741ee){return _0x2b5d22===_0x5741ee;},'yWOXV':function(_0x335657,_0x4fe05a){return _0x335657===_0x4fe05a;},'RRYhR':_0x1519(0xa5),'aBOEe':'๐ง\x20Platform\x20auth\x20service\x20initialized','OuUpc':_0x1519(0x179),'CVHlL':function(_0x592586){return _0x592586();},'JlCwe':'โ
\x20Revoked\x20existing\x20permissions\x20-\x20fresh\x20consent\x20REQUIRED','sYvcL':_0x1519(0x17a),'bZACr':_0x1519(0x17b),'nCmJL':_0x1519(0x17c),'yYzNZ':function(_0x4c2f8e,_0x557cbb){return _0x4c2f8e===_0x557cbb;},'Qtlyz':function(_0x31dc08,_0x5e52b0){return _0x31dc08===_0x5e52b0;},'YzZVd':function(_0x38c9a0,_0x37edde){return _0x38c9a0!==_0x37edde;},'YzQpS':_0x1519(0x17d),'BfKNn':_0x1519(0x17e),'JGiIr':_0x1519(0x17f),'pyObR':_0x1519(0xbb),'iKRVp':_0x1519(0x180),'PXLER':'โ\x20Error\x20with\x20revoke\x20method:'};try{if(_0x545d66[_0x1519(0x181)](_0x545d66[_0x1519(0x182)],_0x545d66[_0x1519(0x182)])){var _0x363e18;console['log'](_0x1519(0x183)),console[_0x1519(0x31)](_0x1519(0xab),_0xba02bd),_0x545d66['CVHlL'](initializeGoogleSignIn),await GoogleSignin[_0x1519(0xea)]();try{await GoogleSignin[_0x1519(0x184)](),console[_0x1519(0x31)](_0x545d66[_0x1519(0x185)]);}catch(_0x3a9ad8){console[_0x1519(0x31)](_0x545d66[_0x1519(0x186)],_0x3a9ad8);}await GoogleSignin[_0x1519(0xdf)](),console[_0x1519(0x31)](_0x545d66[_0x1519(0x187)]),console[_0x1519(0x31)](_0x545d66[_0x1519(0x188)]);const _0x594b6d=await GoogleSignin[_0x1519(0x189)](),_0x1bf417=await GoogleSignin[_0x1519(0x18a)](),_0x204143=await GoogleSignin[_0x1519(0xf5)](),_0x5e4bfb=(_0x545d66[_0x1519(0x181)](_0x363e18=_0x594b6d[_0x1519(0xf0)],null)||_0x363e18===void 0x0?void 0x0:_0x363e18[_0x1519(0x57)])||(_0x545d66['yYzNZ'](_0x204143,null)||_0x545d66[_0x1519(0x18b)](_0x204143,void 0x0)?void 0x0:_0x204143[_0x1519(0x57)]);if(_0x5e4bfb){if(_0x545d66[_0x1519(0x18c)](_0x545d66[_0x1519(0x18d)],_0x545d66[_0x1519(0x18e)]))return console[_0x1519(0x31)](_0x545d66[_0x1519(0x18f)]),console['log'](_0x545d66[_0x1519(0x190)],_0x5e4bfb[_0x1519(0x45)](0x0,0x14)+'...'),!![];else{var _0x1ad97f,_0xea16dd;_0x540ff1[_0x1519(0x31)](_0x545d66[_0x1519(0x191)],_0x3f5160[_0x1519(0x43)]),_0x759fc9=(_0x545d66[_0x1519(0x192)](_0x1ad97f=_0x4bdf7f[_0x1519(0xf0)],null)||_0x1ad97f===void 0x0||_0x545d66[_0x1519(0x193)](_0x1ad97f=_0x1ad97f[_0x1519(0xf3)],null)||_0x545d66[_0x1519(0x194)](_0x1ad97f,void 0x0)?void 0x0:_0x1ad97f[_0x1519(0x4a)])||(_0x545d66[_0x1519(0x181)](_0xea16dd=_0x6bcd8a[_0x1519(0xf0)],null)||_0xea16dd===void 0x0||(_0xea16dd=_0xea16dd[_0x1519(0xf3)])===null||_0x545d66[_0x1519(0x192)](_0xea16dd,void 0x0)?void 0x0:_0xea16dd[_0x1519(0x97)])||_0x545d66['RRYhR'];}}else return console[_0x1519(0x39)](_0x545d66[_0x1519(0x195)]),![];}else _0x50ecaf[_0x1519(0x31)](_0x545d66['aBOEe']),_0x2522a9();}catch(_0x30913b){return console[_0x1519(0x39)](_0x545d66['PXLER'],_0x30913b),![];}};export const fixUserYouTubeConnection=async _0x23ae59=>{const _0x50f3c1={'oGJZf':'Verification\x20code\x20sent\x20to\x20your\x20email','GDWbY':_0x1519(0x196),'dcATt':function(_0x469602,_0x2a9b81){return _0x469602(_0x2a9b81);},'ykRpZ':_0x1519(0x197)};console[_0x1519(0x31)](_0x1519(0x198)+_0x23ae59),console[_0x1519(0x31)](_0x50f3c1[_0x1519(0x199)]);let _0x5e3af8=await _0x50f3c1[_0x1519(0x19a)](forceYouTubeReconnectionWithConsent,_0x23ae59);if(_0x5e3af8)return console[_0x1519(0x31)]('โ
\x20'+_0x23ae59+_0x1519(0x19b)),!![];console[_0x1519(0x31)](_0x1519(0x19c)),_0x5e3af8=await _0x50f3c1[_0x1519(0x19a)](forceYouTubeReconnectionWithRevoke,_0x23ae59);if(_0x5e3af8)return _0x1519(0x19d)!==_0x50f3c1[_0x1519(0x19e)]?(console[_0x1519(0x31)]('โ
\x20'+_0x23ae59+_0x1519(0x19f)),!![]):{'success':!![],'message':_0x36b80a['message']||_0x50f3c1['oGJZf']};return console[_0x1519(0x39)]('โ\x20Failed\x20to\x20fix\x20'+_0x23ae59+'\x20YouTube\x20connection\x20with\x20both\x20methods'),![];};const refreshGoogleTokens=async()=>{const _0xa1e554={'UxASG':'โ\x20Sign-in\x20already\x20in\x20progress','oLrYz':_0x1519(0xbb),'iEawZ':function(_0x4748f1,_0x36386a){return _0x4748f1===_0x36386a;},'rPvKl':'BPidt','gOvNS':_0x1519(0x1a0),'asqLj':_0x1519(0x55),'UOzKO':_0x1519(0x1a1),'aMiCY':_0x1519(0x1a2),'ZOiHO':'CgUBB','Whqiy':'๐\x20Refresh\x20failed,\x20attempting\x20re-authentication...','rJswL':_0x1519(0x1a3),'Yfkub':'โ\x20Re-authentication\x20also\x20failed:'};try{if(_0xa1e554[_0x1519(0x1a4)](_0xa1e554[_0x1519(0x1a5)],'BPidt')){console[_0x1519(0x31)](_0xa1e554['gOvNS']);const _0x1cb95a=await GoogleSignin[_0x1519(0xf5)]();if(!_0x1cb95a)return console[_0x1519(0x31)](_0xa1e554[_0x1519(0x1a6)]),null;const _0x2af1e6=await GoogleSignin[_0x1519(0x18a)]();return console['log'](_0xa1e554[_0x1519(0x1a7)]),{'accessToken':_0x2af1e6[_0x1519(0xe1)],'idToken':_0x2af1e6[_0x1519(0xfc)]};}else _0x3bea5d['error'](_0xa1e554['UxASG']);}catch(_0x516475){console['error'](_0xa1e554['aMiCY'],_0x516475);try{if(_0xa1e554[_0x1519(0x1a8)]===_0xa1e554[_0x1519(0x1a8)]){console['log'](_0xa1e554[_0x1519(0x1a9)]);const _0x4056e1=await GoogleSignin[_0x1519(0x189)](),_0x36ad68=await GoogleSignin[_0x1519(0x18a)]();return console[_0x1519(0x31)](_0xa1e554[_0x1519(0x1aa)]),{'accessToken':_0x36ad68[_0x1519(0xe1)],'idToken':_0x36ad68[_0x1519(0xfc)]};}else _0x2302dd=_0x49862f[_0x1519(0x57)],_0x428a56[_0x1519(0x31)](_0x1519(0x1ab)),_0x24d95d[_0x1519(0x31)](_0xa1e554[_0x1519(0x1ac)],_0x314462['substring'](0x0,0x14)+_0x1519(0xff));}catch(_0x5d74a6){return console['error'](_0xa1e554['Yfkub'],_0x5d74a6),null;}}},debugYouTubeTokens=async()=>{const _0x585e77={'zIycj':_0x1519(0x1ad),'hhDeU':_0x1519(0xb7),'RrHGc':_0x1519(0xb8),'WAmWH':function(_0x54bd24,_0x5cbe1e){return _0x54bd24!==_0x5cbe1e;},'AUcjN':function(_0x262f69,_0x1b4d12){return _0x262f69!==_0x1b4d12;},'JxRoV':function(_0x12b5d3,_0x543518){return _0x12b5d3===_0x543518;},'XlmWZ':_0x1519(0x57),'kPvQV':_0x1519(0x39)};try{var _0x9c96e0;const _0x403649=await GoogleSignin[_0x1519(0x18a)](),_0x16cb80=await GoogleSignin['getCurrentUser']();return console['log'](_0x585e77[_0x1519(0x1ae)],{'accessToken':_0x403649[_0x1519(0xe1)]?_0x403649[_0x1519(0xe1)][_0x1519(0x45)](0x0,0x14)+'...':_0x585e77['hhDeU'],'idToken':_0x403649['idToken']?_0x585e77[_0x1519(0x1af)]:_0x585e77[_0x1519(0x1b0)],'serverAuthCode':_0x585e77[_0x1519(0x1b1)](_0x16cb80,null)&&_0x585e77[_0x1519(0x1b2)](_0x16cb80,void 0x0)&&_0x16cb80['serverAuthCode']?_0x16cb80[_0x1519(0x57)][_0x1519(0x45)](0x0,0x14)+'...':_0x1519(0xb7),'userEmail':(_0x585e77[_0x1519(0x1b3)](_0x16cb80,null)||_0x16cb80===void 0x0||(_0x9c96e0=_0x16cb80['user'])===null||_0x9c96e0===void 0x0?void 0x0:_0x9c96e0[_0x1519(0x97)])||_0x585e77['hhDeU']}),{'hasRefreshToken':!!(_0x16cb80!==null&&_0x585e77['WAmWH'](_0x16cb80,void 0x0)&&_0x16cb80[_0x1519(0x57)]),'refreshTokenType':_0x16cb80!==null&&_0x16cb80!==void 0x0&&_0x16cb80[_0x1519(0x57)]?_0x585e77[_0x1519(0x1b4)]:_0x1519(0x1b5)};}catch(_0x2c84a8){return console[_0x1519(0x39)](_0x1519(0x1b6),_0x2c84a8),{'hasRefreshToken':![],'refreshTokenType':_0x585e77[_0x1519(0x1b7)]};}};export const reconnectYouTube=async _0x398046=>{const _0x1377b4={'LIRhK':function(_0x2165e7){return _0x2165e7();},'xBdVO':_0x1519(0x0),'TjzWx':function(_0x5dde3f,_0xd1883f){return _0x5dde3f!==_0xd1883f;},'Cmwuj':function(_0x56aa17,_0x5b7382){return _0x56aa17!==_0x5b7382;},'CXazM':_0x1519(0x7),'EMsGR':function(_0x23367b){return _0x23367b();},'JeHsm':_0x1519(0x1b8),'Nuesg':_0x1519(0x1b9),'PAucQ':_0x1519(0x1ba),'RPjwH':_0x1519(0x1bb),'qaDLb':'โ
\x20Signed\x20out\x20from\x20Google','HsIvE':'โน๏ธ\x20Already\x20signed\x20out\x20or\x20sign\x20out\x20failed:','xKELj':function(_0x593cdd,_0x60a7e8){return _0x593cdd!==_0x60a7e8;},'XXYVe':_0x1519(0x1bc),'XOvep':function(_0x4edf17,_0x275682){return _0x4edf17!==_0x275682;},'xgmMm':_0x1519(0x1bd),'eGJzk':_0x1519(0x1be),'GpYIL':_0x1519(0x1bf),'ZOFmP':function(_0x23e78c,_0x47555c,_0x411f88){return _0x23e78c(_0x47555c,_0x411f88);},'jyJTY':_0x1519(0x1c0),'axwnM':function(_0x48d39e,_0x5dc4a9){return _0x48d39e===_0x5dc4a9;},'tWRIv':_0x1519(0x1c1),'okcyk':_0x1519(0x1c2),'SWhdp':function(_0x2f93e8,_0x273863){return _0x2f93e8===_0x273863;},'PGmBu':_0x1519(0x1c3),'ExQcH':function(_0x4aed4c,_0x5c5307){return _0x4aed4c===_0x5c5307;},'FPFvL':_0x1519(0x1c4),'Bicbx':_0x1519(0x1c5)};try{console[_0x1519(0x31)](_0x1377b4[_0x1519(0x1c6)]);try{await GoogleSignin[_0x1519(0xdf)](),console[_0x1519(0x31)](_0x1377b4['qaDLb']);}catch(_0x4bb374){console[_0x1519(0x31)](_0x1377b4[_0x1519(0x1c7)],_0x4bb374);}try{if(_0x1377b4[_0x1519(0x1c8)](_0x1519(0x1bc),_0x1377b4[_0x1519(0x1c9)])){if(!_0x1377b4[_0x1519(0x1ca)](_0x1a0d56))throw new _0x3d7576(_0x1377b4[_0x1519(0x1cb)]);const _0x35d3b1=_0x1377b4[_0x1519(0x1ca)](_0x428b68);if(!(_0x1377b4[_0x1519(0x1cc)](_0x35d3b1,null)&&_0x1377b4['Cmwuj'](_0x35d3b1,void 0x0)&&_0x35d3b1[_0x1519(0x6)]))throw new _0x24ea92(_0x1377b4[_0x1519(0x1cd)]);return{..._0x1377b4['EMsGR'](_0x8a2e99),'Authorization':_0x1519(0x10b)+_0x35d3b1[_0x1519(0x6)],'X-SDK-Version':_0x1377b4[_0x1519(0x1ce)],'X-SDK-Platform':'react-native'};}else{const _0x14df19=await GoogleSignin[_0x1519(0x18a)]();if(_0x14df19['accessToken']){if(_0x1377b4[_0x1519(0x1cf)](_0x1377b4['xgmMm'],_0x1377b4['xgmMm']))return _0x472197[_0x1519(0x31)]('โ
\x20'+_0x418c15+'\x20YouTube\x20connection\x20fixed\x20via\x20Method\x202!'),!![];else await GoogleSignin[_0x1519(0xe2)](_0x14df19[_0x1519(0xe1)]),console[_0x1519(0x31)](_0x1377b4[_0x1519(0x1d0)]);}}}catch(_0x34e6d){console[_0x1519(0x31)](_0x1377b4[_0x1519(0x1d1)],_0x34e6d);}const _0x73c0f4=await _0x1377b4[_0x1519(0x1d2)](initiateNativeAuth,_0x1519(0xc5),_0x398046);if(_0x73c0f4){console[_0x1519(0x31)](_0x1377b4[_0x1519(0x1d3)]);const _0x3b0385=await _0x1377b4[_0x1519(0x1d4)](debugYouTubeTokens);return _0x3b0385['hasRefreshToken']?_0x1377b4[_0x1519(0x1d5)](_0x1377b4[_0x1519(0x1d6)],'MkTRT')?_0x37e33d['log'](_0x1377b4['Nuesg'],_0x5cce44):console['log'](_0x1377b4[_0x1519(0x1d7)],_0x3b0385['refreshTokenType']):console[_0x1519(0x75)]('โ ๏ธ\x20Still\x20no\x20refresh\x20token\x20after\x20reconnection'),!![];}else{if(_0x1377b4['SWhdp'](_0x1519(0x1c3),_0x1377b4[_0x1519(0x1d8)]))return console[_0x1519(0x39)](_0x1519(0x9c)),![];else _0x53715b[_0x1519(0x31)](_0x1377b4[_0x1519(0x1d9)]),_0x246e92(!![]);}}catch(_0x3b8fec){if(_0x1377b4[_0x1519(0x1da)](_0x1377b4[_0x1519(0x1db)],_0x1519(0x1dc)))_0x5a95e8['warn'](_0x1519(0x1dd));else return console['error'](_0x1377b4[_0x1519(0x1de)],_0x3b8fec),![];}};export const initiateNativeAuth=async(_0x550964,_0x3eaf73)=>{const _0x3c564b={'woTVM':_0x1519(0x1df),'HIxcb':_0x1519(0x1e0),'nWJbn':'Facebook\x20Login\x20completed\x20successfully','WINpt':function(_0x3c3f8e,_0x38d425){return _0x3c3f8e(_0x38d425);},'YhSTz':_0x1519(0x1e1),'nPkWg':_0x1519(0x1b6),'Hsghs':_0x1519(0x39),'Zidwu':'๐\x20[YOUTUBE\x20REAUTH]\x20Training\x20Ready:\x20Yes','Dwskq':_0x1519(0x153),'SYniM':'๐\x20[YOUTUBE\x20REAUTH]\x20Refresh\x20token\x20sent:','jGHON':'Yes','rQvrq':_0x1519(0xcd),'ayREa':function(_0x1120cc,_0x3cbcae){return _0x1120cc===_0x3cbcae;},'KyiOg':'Network\x20request\x20failed','QDYHn':_0x1519(0x59),'LbJTy':_0x1519(0x5a),'Zqjuu':_0x1519(0x1e2),'coUvf':'\x20\x20\x204.\x20SSL/TLS\x20certificate\x20issue','htopi':'\x20\x20\x205.\x20iOS\x20simulator\x20network\x20sandbox\x20issue\x20-\x20try\x20on\x20physical\x20device','ACRbd':_0x1519(0x2b),'VisOj':function(_0x59ef0f,_0x2ef7c0,_0x5b0e38){return _0x59ef0f(_0x2ef7c0,_0x5b0e38);},'ydXIq':_0x1519(0x1e3),'nVoGe':_0x1519(0x1e4),'HQoDi':function(_0x25d37b,_0x1af4fa){return _0x25d37b(_0x1af4fa);},'nLtUz':function(_0x3021ee,_0x3c47a8){return _0x3021ee===_0x3c47a8;},'MtUhi':_0x1519(0xc5),'xOCtg':function(_0x210660,_0xf2dad6){return _0x210660===_0xf2dad6;},'zJUks':_0x1519(0x1e5),'zNtFd':function(_0x189e21,_0x15457e){return _0x189e21!==_0x15457e;},'lTUcX':_0x1519(0x1e6),'lcZzT':function(_0x8ae7ed){return _0x8ae7ed();},'bECRC':_0x1519(0x1e7),'BQJJX':_0x1519(0x1e8),'IDiHw':_0x1519(0x1b9),'YkBBN':function(_0x4bcd63,_0x21b4de){return _0x4bcd63===_0x21b4de;},'UUhOr':function(_0x19c958,_0x549774){return _0x19c958===_0x549774;},'JMkLv':'๐\x20FULL\x20userInfo\x20object:','iOHSa':_0x1519(0x1e9),'XrtWb':function(_0x5ef28a,_0x26e270){return _0x5ef28a===_0x26e270;},'ASQan':function(_0x1e1e57,_0x55bde7){return _0x1e1e57===_0x55bde7;},'LWnDJ':function(_0x3a8e34,_0x1cd187){return _0x3a8e34===_0x1cd187;},'UeLcb':function(_0x1a4a30,_0x460653){return _0x1a4a30===_0x460653;},'IqfUh':_0x1519(0x1ea),'whDgH':_0x1519(0x1eb),'XzWFu':_0x1519(0x1ec),'nkzVy':_0x1519(0xb7),'ambGy':'-\x20currentUser?.serverAuthCode:','UnZQR':_0x1519(0x1ed),'oiCaA':_0x1519(0x1ee),'CFFNs':_0x1519(0x1ab),'PXSui':_0x1519(0xbb),'EwMhK':_0x1519(0x1ef),'ZtFby':_0x1519(0x9e),'leULQ':_0x1519(0x9f),'ReVNF':_0x1519(0xa0),'BikaZ':_0x1519(0xa1),'aaMGH':_0x1519(0x1f0),'JRVlb':_0x1519(0x1f1),'bMuZW':_0x1519(0x56),'QyUqj':_0x1519(0x57),'YgWBl':_0x1519(0x58),'HtdrE':'Unknown\x20Channel','tjAtR':'๐บ\x20Fetching\x20YouTube\x20channel\x20information...','skIwU':function(_0x4ee05d,_0x22b172,_0x4bd72b){return _0x4ee05d(_0x22b172,_0x4bd72b);},'zIBsi':_0x1519(0x1f2),'jLIse':function(_0x2be91a,_0x45d9de){return _0x2be91a>_0x45d9de;},'kylCm':'sZdii','Fxama':'fuZAj','aTAxM':'โ
\x20YouTube\x20channel\x20found:','zVYrJ':_0x1519(0xa3),'UwTXa':'โ ๏ธ\x20No\x20YouTube\x20channel\x20found\x20for\x20user','ScEYv':function(_0x5179f9,_0x3bb0b6){return _0x5179f9===_0x3bb0b6;},'WoKtp':function(_0x506215,_0x1413da){return _0x506215===_0x1413da;},'STkZC':function(_0x1b2bf8,_0x1f58d8){return _0x1b2bf8===_0x1f58d8;},'JHglC':_0x1519(0x1f3),'DOzQf':'โ ๏ธ\x20Failed\x20to\x20fetch\x20YouTube\x20channel\x20info:','WRrVF':function(_0x5b4fce,_0xca04f5){return _0x5b4fce===_0xca04f5;},'RhKoF':function(_0x5bcabc,_0x15713f){return _0x5bcabc===_0x15713f;},'QjetR':function(_0xbc0591,_0x5c7d27){return _0xbc0591===_0x5c7d27;},'ygzuW':function(_0x391bd0,_0x219ab2){return _0x391bd0===_0x219ab2;},'MxOtl':function(_0x484a6f,_0x48671f){return _0x484a6f===_0x48671f;},'ilrnx':'โ ๏ธ\x20Error\x20fetching\x20YouTube\x20channel\x20info:','iOBGB':function(_0x4725ca,_0x3fd6c4){return _0x4725ca===_0x3fd6c4;},'kdzLa':function(_0x1c5653,_0x2daca4){return _0x1c5653===_0x2daca4;},'DwTIQ':function(_0x67676e,_0x388dad){return _0x67676e===_0x388dad;},'vfcOc':function(_0x4c2086,_0x5498e8){return _0x4c2086===_0x5498e8;},'qbMMy':function(_0x4d7be9,_0x2acb18){return _0x4d7be9===_0x2acb18;},'ajKeJ':'onairos_username','AKBqu':function(_0x31c14a,_0x563ec4){return _0x31c14a||_0x563ec4;},'wMLXB':function(_0x7f8ca8,_0x373263){return _0x7f8ca8===_0x373263;},'jHqEI':function(_0x1f0eae,_0x20eb34){return _0x1f0eae===_0x20eb34;},'TPgUT':function(_0x58b5f0,_0x50a946){return _0x58b5f0<_0x50a946;},'WLpAV':'โน๏ธ\x20No\x20valid\x20authentication\x20token\x20found\x20for\x20YouTube\x20connection','QoEUA':'โน๏ธ\x20NOTE:\x20SDK\x20does\x20not\x20create\x20users\x20during\x20YouTube\x20connection','ywSjV':_0x1519(0x1f4),'nHUqR':'xPkSy','ThtkA':'oQygp','qpxqW':_0x1519(0x1f5),'UNdCW':_0x1519(0x1f6),'CBBvl':_0x1519(0x1f7),'uTYmo':_0x1519(0x1f8),'CokdD':'๐บ\x20YouTube\x20channel\x20name:','QWzZl':function(_0x3974c3,_0x4367db){return _0x3974c3===_0x4367db;},'UrxeG':function(_0x1854f4,_0x2ce51a){return _0x1854f4===_0x2ce51a;},'AeGuh':function(_0x155cb8,_0x882fca){return _0x155cb8===_0x882fca;},'DyIcp':function(_0x14acb2,_0x300838){return _0x14acb2===_0x300838;},'Lnfwm':function(_0x563395,_0x84e559){return _0x563395===_0x84e559;},'sYAuA':function(_0x1a8437,_0x5b982b){return _0x1a8437===_0x5b982b;},'rkyRP':_0x1519(0x1f9),'tUTdT':function(_0x402c46,_0x4e5fb2){return _0x402c46+_0x4e5fb2;},'CIfdm':function(_0x5c43c5,_0x13e01a){return _0x5c43c5*_0x13e01a;},'UtbtE':_0x1519(0x1fa),'YeWSF':_0x1519(0x1fb),'aHnhO':'-\x20hasServerAuthCode:','auAGJ':function(_0x321310,_0x392d56){return _0x321310===_0x392d56;},'daADM':function(_0x3722f3,_0x174e46){return _0x3722f3===_0x174e46;},'hkWyA':'๐\x20COMPLETE\x20BACKEND\x20PAYLOAD:','GUwwx':'๐ค\x20Sending\x20YouTube\x20auth\x20to\x20backend\x20with\x20refresh\x20token:','AhfFL':function(_0x372107,_0x38e454){return _0x372107&&_0x38e454;},'gqxLT':_0x1519(0x1fc),'FhAXI':_0x1519(0x1fd),'ykapR':_0x1519(0x1fe),'jMQeH':_0x1519(0x1ff),'UcZLo':'๐\x20COMPLETE\x20BACKEND\x20RESPONSE:','FUqiS':_0x1519(0x200),'gOTUn':_0x1519(0x201),'ckNsS':_0x1519(0x202),'FGJUG':function(_0x4d84e3,_0x3c8a85){return _0x4d84e3===_0x3c8a85;},'yZKFv':_0x1519(0x203),'zmRkK':_0x1519(0x204),'jrtRE':_0x1519(0x205),'fypbx':_0x1519(0x206),'LLVPw':_0x1519(0x207),'hDHom':_0x1519(0x208),'MtZyN':_0x1519(0x209),'gGznt':_0x1519(0x20a),'VPXlW':'User\x20cancelled\x20Google\x20Sign-In','EEezJ':_0x1519(0x20b),'YYJrG':_0x1519(0x20c),'tkofn':_0x1519(0x20d),'dPTgC':_0x1519(0x20e),'XJpps':_0x1519(0x20f)};if(_0x3c564b[_0x1519(0x210)](_0x550964,_0x3c564b['MtUhi'])){console[_0x1519(0x31)](_0x1519(0x211));if(!_0x3eaf73||_0x3c564b[_0x1519(0x212)](_0x3eaf73['trim'](),''))return console['error'](_0x3c564b[_0x1519(0x213)]),![];try{if(_0x3c564b[_0x1519(0x214)](_0x3c564b[_0x1519(0x215)],_0x3c564b[_0x1519(0x215)]))return _0x31fc9b[_0x1519(0x150)](_0x3c564b[_0x1519(0x216)])||_0x1a1b8c['includes'](_0x3c564b[_0x1519(0x217)]);else{var _0x46eae9,_0x59f46a,_0x1e057c,_0x184be0,_0x10d0b8,_0xa9338c,_0x447a69,_0x224baf,_0x39dc13,_0xa1aa65;_0x3c564b['lcZzT'](initializeGoogleSignIn),await GoogleSignin[_0x1519(0xea)]();try{_0x3c564b[_0x1519(0x218)]!=='Iwzgz'?(await GoogleSignin['signOut'](),console[_0x1519(0x31)](_0x3c564b['BQJJX'])):_0x3bf36b(()=>{_0x3bcef8[_0x1519(0x31)](_0x3c564b[_0x1519(0x219)]),_0x3c564b[_0x1519(0x21a)](_0x30cb98,!![]);},0x3e8);}catch(_0x532c15){console['log'](_0x3c564b[_0x1519(0x21b)],_0x532c15);}const _0x340a7c=await GoogleSignin[_0x1519(0x189)]();console[_0x1519(0x31)](_0x1519(0x21c),_0x3c564b[_0x1519(0x21d)](_0x46eae9=_0x340a7c[_0x1519(0xf0)],null)||_0x3c564b[_0x1519(0x21e)](_0x46eae9,void 0x0)||_0x3c564b['ayREa'](_0x46eae9=_0x46eae9[_0x1519(0xf3)],null)||_0x3c564b[_0x1519(0x21f)](_0x46eae9,void 0x0)?void 0x0:_0x46eae9[_0x1519(0x97)]),console['log'](_0x3c564b[_0x1519(0x220)]),console['log'](JSON[_0x1519(0x7a)](_0x340a7c,null,0x2));const _0x19592f=await GoogleSignin[_0x1519(0x18a)]();console[_0x1519(0x31)](_0x3c564b[_0x1519(0x221)]),console[_0x1519(0x31)](_0x1519(0x222)),console['log'](JSON['stringify'](_0x19592f,null,0x2));const _0x2a0ec0=await GoogleSignin[_0x1519(0xf5)]();console['log']('๐ค\x20Current\x20user\x20info:',_0x3c564b[_0x1519(0x223)](_0x2a0ec0,null)||_0x3c564b['ASQan'](_0x2a0ec0,void 0x0)||_0x3c564b[_0x1519(0x224)](_0x59f46a=_0x2a0ec0[_0x1519(0xf3)],null)||_0x3c564b['UeLcb'](_0x59f46a,void 0x0)?void 0x0:_0x59f46a[_0x1519(0x97)]),console[_0x1519(0x31)](_0x3c564b[_0x1519(0x225)]),console[_0x1519(0x31)](JSON['stringify'](_0x2a0ec0,null,0x2));let _0x3d70d4=null;console[_0x1519(0x31)](_0x3c564b['whDgH']),console['log'](_0x3c564b[_0x1519(0x226)],(_0x1e057c=_0x340a7c['data'])!==null&&_0x3c564b[_0x1519(0x214)](_0x1e057c,void 0x0)&&_0x1e057c[_0x1519(0x57)]?_0x1519(0x227)+_0x340a7c[_0x1519(0xf0)][_0x1519(0x57)][_0x1519(0x45)](0x0,0x14)+_0x1519(0xff):_0x3c564b[_0x1519(0x228)]),console['log'](_0x3c564b['ambGy'],_0x3c564b[_0x1519(0x214)](_0x2a0ec0,null)&&_0x2a0ec0!==void 0x0&&_0x2a0ec0[_0x1519(0x57)]?'Present:\x20'+_0x2a0ec0['serverAuthCode'][_0x1519(0x45)](0x0,0x14)+'...':_0x3c564b[_0x1519(0x228)]),console[_0x1519(0x31)](_0x3c564b[_0x1519(0x229)],_0x19592f[_0x1519(0xfc)]?_0x1519(0x227)+_0x19592f[_0x1519(0xfc)]['substring'](0x0,0x14)+'...':_0x3c564b['nkzVy']),console[_0x1519(0x31)](_0x3c564b[_0x1519(0x22a)],_0x19592f[_0x1519(0xe1)]?'Present:\x20'+_0x19592f['accessToken'][_0x1519(0x45)](0x0,0x14)+'...':_0x3c564b['nkzVy']);if(_0x3c564b[_0x1519(0x214)](_0x2a0ec0,null)&&_0x2a0ec0!==void 0x0&&_0x2a0ec0[_0x1519(0x57)])_0x3d70d4=_0x2a0ec0[_0x1519(0x57)],console[_0x1519(0x31)](_0x3c564b[_0x1519(0x22b)]),console[_0x1519(0x31)](_0x3c564b[_0x1519(0x22c)],_0x3d70d4[_0x1519(0x45)](0x0,0x14)+_0x1519(0xff));else _0x3c564b[_0x1519(0x214)](_0x184be0=_0x340a7c[_0x1519(0xf0)],null)&&_0x184be0!==void 0x0&&_0x184be0[_0x1519(0x57)]&&(_0x3d70d4=_0x340a7c[_0x1519(0xf0)][_0x1519(0x57)],console[_0x1519(0x31)](_0x3c564b[_0x1519(0x22d)]),console[_0x1519(0x31)](_0x3c564b[_0x1519(0x22c)],_0x3d70d4['substring'](0x0,0x14)+_0x1519(0xff)));if(!_0x3d70d4)console[_0x1519(0x39)](_0x3c564b[_0x1519(0x22e)]),console[_0x1519(0x39)](_0x3c564b['leULQ']),console[_0x1519(0x39)](_0x3c564b['ReVNF']),console[_0x1519(0x75)](_0x3c564b[_0x1519(0x22f)]);else{if(_0x3c564b[_0x1519(0x230)]===_0x3c564b['aaMGH'])console[_0x1519(0x31)](_0x3c564b[_0x1519(0x231)]),console[_0x1519(0x31)](_0x3c564b[_0x1519(0x232)],_0x3d70d4[_0x1519(0x8a)]('4/')?_0x3c564b[_0x1519(0x233)]:_0x3c564b[_0x1519(0x234)]);else return _0x53a08a[_0x1519(0x39)](_0x3c564b[_0x1519(0x235)],_0x5143a8),![];}let _0x343d1b=_0x3c564b[_0x1519(0x236)],_0x1a448e=null;try{console[_0x1519(0x31)](_0x3c564b['tjAtR']);const _0xc998b0=await _0x3c564b[_0x1519(0x237)](fetch,_0x3c564b['zIBsi'],{'headers':{'Authorization':_0x1519(0x10b)+_0x19592f[_0x1519(0xe1)],'Accept':'application/json'}});if(_0xc998b0['ok']){const _0x2036b5=await _0xc998b0[_0x1519(0x10c)]();if(_0x2036b5['items']&&_0x3c564b[_0x1519(0x238)](_0x2036b5['items'][_0x1519(0x10e)],0x0)){if(_0x3c564b[_0x1519(0x210)](_0x3c564b['kylCm'],_0x3c564b[_0x1519(0x239)]))return _0x2b7e6f[_0x1519(0x31)]('๐ง\x20[OAUTH]\x20Email\x20platform\x20selected,\x20returning\x20mock\x20auth\x20URL'),_0x436e1e[_0x1519(0xe)]+'/email/authorize?action=verify';else _0x343d1b=_0x2036b5['items'][0x0]['snippet'][_0x1519(0x165)],_0x1a448e=_0x2036b5['items'][0x0]['id'],console[_0x1519(0x31)](_0x3c564b[_0x1519(0x23a)],_0x343d1b,_0x3c564b['zVYrJ'],_0x1a448e);}else{var _0x4f096f,_0x7ad432;console[_0x1519(0x31)](_0x3c564b[_0x1519(0x23b)]),_0x343d1b=(_0x3c564b[_0x1519(0x23c)](_0x4f096f=_0x340a7c[_0x1519(0xf0)],null)||_0x3c564b[_0x1519(0x23d)](_0x4f096f,void 0x0)||_0x3c564b['YkBBN'](_0x4f096f=_0x4f096f['user'],null)||_0x3c564b['UeLcb'](_0x4f096f,void 0x0)?void 0x0:_0x4f096f[_0x1519(0x4a)])||(_0x3c564b['UeLcb'](_0x7ad432=_0x340a7c[_0x1519(0xf0)],null)||_0x3c564b['WoKtp'](_0x7ad432,void 0x0)||_0x3c564b['STkZC'](_0x7ad432=_0x7ad432[_0x1519(0xf3)],null)||_0x3c564b[_0x1519(0x210)](_0x7ad432,void 0x0)?void 0x0:_0x7ad432['email'])||'No\x20Channel';}}else{if(_0x3c564b['nLtUz'](_0x3c564b['JHglC'],_0x3c564b[_0x1519(0x23e)])){var _0x41c203,_0x147a5b;console['log'](_0x3c564b[_0x1519(0x23f)],_0xc998b0[_0x1519(0x43)]),_0x343d1b=(_0x3c564b[_0x1519(0x240)](_0x41c203=_0x340a7c[_0x1519(0xf0)],null)||_0x3c564b[_0x1519(0x241)](_0x41c203,void 0x0)||_0x3c564b[_0x1519(0x242)](_0x41c203=_0x41c203['user'],null)||_0x3c564b[_0x1519(0x243)](_0x41c203,void 0x0)?void 0x0:_0x41c203['name'])||(_0x3c564b['XrtWb'](_0x147a5b=_0x340a7c[_0x1519(0xf0)],null)||_0x3c564b[_0x1519(0x244)](_0x147a5b,void 0x0)||_0x3c564b[_0x1519(0x245)](_0x147a5b=_0x147a5b['user'],null)||_0x147a5b===void 0x0?void 0x0:_0x147a5b[_0x1519(0x97)])||_0x3c564b[_0x1519(0x236)];}else return _0x3c64a4[_0x1519(0x39)](_0x3c564b['nPkWg'],_0x57e2cd),{'hasRefreshToken':![],'refreshTokenType':_0x3c564b[_0x1519(0x246)]};}}catch(_0x15fb22){var _0x5aa7cd,_0x5b2835;console['log'](_0x3c564b[_0x1519(0x247)],_0x15fb22),_0x343d1b=(_0x3c564b[_0x1519(0x248)](_0x5aa7cd=_0x340a7c[_0x1519(0xf0)],null)||_0x5aa7cd===void 0x0||(_0x5aa7cd=_0x5aa7cd[_0x1519(0xf3)])===null||_0x5aa7cd===void 0x0?void 0x0:_0x5aa7cd[_0x1519(0x4a)])||(_0x3c564b[_0x1519(0x249)](_0x5b2835=_0x340a7c[_0x1519(0xf0)],null)||_0x3c564b[_0x1519(0x24a)](_0x5b2835,void 0x0)||_0x3c564b['vfcOc'](_0x5b2835=_0x5b2835[_0x1519(0xf3)],null)||_0x3c564b[_0x1519(0x24b)](_0x5b2835,void 0x0)?void 0x0:_0x5b2835['email'])||_0x3c564b[_0x1519(0x236)];}let _0x313152=await _0x3c564b[_0x1519(0x24c)](getJWT);const _0x3b8c37=await AsyncStorage[_0x1519(0x24d)](_0x3c564b[_0x1519(0x24e)]),_0x34a2de=_0x3c564b[_0x1519(0x24f)](_0x3b8c37,_0x3eaf73)||((_0x10d0b8=_0x340a7c[_0x1519(0xf0)])===null||_0x3c564b['wMLXB'](_0x10d0b8,void 0x0)||_0x3c564b['iOBGB'](_0x10d0b8=_0x10d0b8[_0x1519(0xf3)],null)||_0x3c564b[_0x1519(0x250)](_0x10d0b8,void 0x0)?void 0x0:_0x10d0b8[_0x1519(0x97)])||_0x1519(0x251);if(!_0x313152||_0x3c564b[_0x1519(0x252)](_0x313152[_0x1519(0x12d)]()[_0x1519(0x10e)],0x14))console[_0x1519(0x31)](_0x3c564b[_0x1519(0x253)]),console[_0x1519(0x31)](_0x3c564b['QoEUA']),console['log'](_0x3c564b[_0x1519(0x254)]);else{if(_0x3c564b[_0x1519(0x255)]!==_0x3c564b[_0x1519(0x256)])console[_0x1519(0x31)](_0x1519(0x257)),console['log'](_0x3c564b[_0x1519(0x258)],_0x313152[_0x1519(0x45)](0x0,0x14)+_0x1519(0xff));else{const _0x2637b4=_0x1519(0x259)['split']('|');let _0x156a56=0x0;while(!![]){switch(_0x2637b4[_0x156a56++]){case'0':_0x2fdfae['log'](_0x1519(0x25a));continue;case'1':_0x1e3099['log'](_0x3c564b[_0x1519(0x25b)]);continue;case'2':_0x2a95ae[_0x1519(0x31)](_0x1519(0x156));continue;case'3':_0x3c311f[_0x1519(0x31)]('๐\x20[YOUTUBE\x20REAUTH]\x20SUCCESS:\x20Temporary\x20YouTube\x20connection\x20established!');continue;case'4':_0x209921[_0x1519(0x31)](_0x3c564b[_0x1519(0x25c)]);continue;case'5':_0x44c463[_0x1519(0x31)](_0x3c564b[_0x1519(0x25d)],_0x5186d7?_0x3c564b[_0x1519(0x25e)]:'No');continue;case'6':_0x330ea0[_0x1519(0x31)](_0x3c564b['rQvrq']);continue;}break;}}}console[_0x1519(0x31)](_0x3c564b[_0x1519(0x25f)],_0x34a2de),console['log'](_0x3c564b[_0x1519(0x260)],_0x313152?_0x313152[_0x1519(0x45)](0x0,0x14)+'...':_0x3c564b[_0x1519(0x261)]),console[_0x1519(0x31)](_0x3c564b[_0x1519(0x262)],_0x343d1b);const _0x52885d={'session':{'username':_0x34a2de,'platform':_0x1519(0xc5),'timestamp':new Date()[_0x1519(0x70)](),'channelName':_0x343d1b,'channelId':_0x1a448e},'googleUser':_0x3c564b[_0x1519(0x223)](_0xa9338c=_0x340a7c[_0x1519(0xf0)],null)||_0xa9338c===void 0x0?void 0x0:_0xa9338c[_0x1519(0xf3)],'accessToken':_0x19592f[_0x1519(0xe1)],'idToken':_0x19592f[_0x1519(0xfc)],'refreshToken':_0x3d70d4,'serverAuthCode':_0x3d70d4,'refresh_token':_0x3d70d4,'server_auth_code':_0x3d70d4,'authCode':_0x3d70d4,'userAccountInfo':{'username':_0x34a2de,'email':_0x3c564b[_0x1519(0x263)](_0x447a69=_0x340a7c[_0x1519(0xf0)],null)||_0x3c564b[_0x1519(0x264)](_0x447a69,void 0x0)||_0x3c564b[_0x1519(0x265)](_0x447a69=_0x447a69[_0x1519(0xf3)],null)||_0x3c564b[_0x1519(0x266)](_0x447a69,void 0x0)?void 0x0:_0x447a69[_0x1519(0x97)],'authToken':_0x313152,'channelName':_0x343d1b,'channelId':_0x1a448e,'userIdentifier':_0x313152?_0x1519(0x132)+_0x313152[_0x1519(0x45)](0x0,0xa):_0x1519(0x133)+(_0x3c564b['DwTIQ'](_0x224baf=_0x340a7c[_0x1519(0xf0)],null)||_0x3c564b[_0x1519(0x266)](_0x224baf,void 0x0)||_0x3c564b['Lnfwm'](_0x224baf=_0x224baf[_0x1519(0xf3)],null)||_0x3c564b[_0x1519(0x245)](_0x224baf,void 0x0)?void 0x0:_0x224baf[_0x1519(0x97)]),'googleId':_0x3c564b[_0x1519(0x267)](_0x39dc13=_0x340a7c[_0x1519(0xf0)],null)||_0x3c564b[_0x1519(0x268)](_0x39dc13,void 0x0)||_0x3c564b[_0x1519(0x223)](_0x39dc13=_0x39dc13[_0x1519(0xf3)],null)||_0x39dc13===void 0x0?void 0x0:_0x39dc13['id'],'appleUserId':_0x3c564b[_0x1519(0x214)](_0x313152,null)&&_0x3c564b[_0x1519(0x214)](_0x313152,void 0x0)&&_0x313152[_0x1519(0x150)](_0x3c564b[_0x1519(0x269)])?_0x313152[_0x1519(0x8d)]('.')[0x1]:null,'refreshToken':_0x3d70d4,'serverAuthCode':_0x3d70d4},'tokenExpiry':new Date(_0x3c564b[_0x1519(0x26a)](Date['now'](),_0x3c564b[_0x1519(0x26b)](0xe10,0x3e8)))[_0x1519(0x70)](),'requestRefreshToken':!![],'debugInfo':{'hasRefreshToken':!!_0x3d70d4,'refreshTokenType':_0x3d70d4?_0x3d70d4[_0x1519(0x8a)]('4/')?_0x3c564b[_0x1519(0x233)]:_0x1519(0x58):_0x1519(0x1b5),'configuredForRefresh':!![],'forcedConsent':!![],'refreshTokenValue':_0x3d70d4}};console[_0x1519(0x31)](_0x3c564b[_0x1519(0x26c)]),console[_0x1519(0x31)](_0x1519(0x26d),!!_0x52885d['accessToken']),console[_0x1519(0x31)](_0x3c564b[_0x1519(0x26e)],!!_0x52885d[_0x1519(0x58)]),console[_0x1519(0x31)](_0x3c564b[_0x1519(0x26f)],!!_0x52885d['serverAuthCode']),console[_0x1519(0x31)](_0x1519(0x270),_0x52885d['debugInfo'][_0x1519(0x139)]),console[_0x1519(0x31)](_0x1519(0x271),(_0xa1aa65=_0x340a7c[_0x1519(0xf0)])===null||_0x3c564b[_0x1519(0x223)](_0xa1aa65,void 0x0)||_0x3c564b[_0x1519(0x272)](_0xa1aa65=_0xa1aa65[_0x1519(0xf3)],null)||_0x3c564b[_0x1519(0x273)](_0xa1aa65,void 0x0)?void 0x0:_0xa1aa65[_0x1519(0x97)]),console[_0x1519(0x31)](_0x1519(0x274),_0x343d1b),console[_0x1519(0x31)](_0x3c564b['hkWyA']),console['log'](JSON[_0x1519(0x7a)](_0x52885d,null,0x2)),console['log'](_0x3c564b['GUwwx'],!!_0x3d70d4);const _0x169c72=await _0x3c564b['skIwU'](fetch,API_CONFIG[_0x1519(0xe)]+_0x1519(0x142),{'method':'POST','headers':{'Content-Type':'application/json',..._0x3c564b[_0x1519(0x275)](_0x313152,{'Authorization':_0x313152})},'body':JSON[_0x1519(0x7a)](_0x52885d)});console[_0x1519(0x31)](_0x3c564b[_0x1519(0x276)],_0x169c72[_0x1519(0x43)]),console[_0x1519(0x31)](_0x3c564b[_0x1519(0x277)],_0x169c72[_0x1519(0x147)]);if(_0x169c72['ok']){if(_0x3c564b[_0x1519(0x278)]!==_0x1519(0x279)){var _0x6b4e,_0x159d12;const _0xafdf4f=await _0x169c72[_0x1519(0x10c)]();console[_0x1519(0x31)](_0x3c564b[_0x1519(0x27a)]),console[_0x1519(0x31)](_0x3c564b['UcZLo']),console['log'](JSON[_0x1519(0x7a)](_0xafdf4f,null,0x2));const _0x428e5e=((_0x6b4e=_0xafdf4f['validation'])===null||_0x3c564b['YkBBN'](_0x6b4e,void 0x0)?void 0x0:_0x6b4e[_0x1519(0x14b)])===!![]||_0x3c564b['jHqEI']((_0x159d12=_0xafdf4f[_0x1519(0x14d)])===null||_0x3c564b['ASQan'](_0x159d12,void 0x0)?void 0x0:_0x159d12[_0x1519(0x14e)],!![])||_0xafdf4f['isTemporaryMode']===!![]||_0xafdf4f[_0x1519(0x38)]&&_0xafdf4f[_0x1519(0x38)]['includes']('temporary\x20access\x20token\x20mode');if(_0x428e5e){if(_0x1519(0x200)===_0x3c564b[_0x1519(0x27b)])console[_0x1519(0x31)](_0x3c564b[_0x1519(0x27c)]),console[_0x1519(0x31)](_0x3c564b['ckNsS']),console[_0x1519(0x31)](_0x1519(0x27d));else return{'success':![],'error':_0x1d253f[_0x1519(0x38)]||_0x1519(0x27e)};}else{if(_0xafdf4f[_0x1519(0x158)]||_0xafdf4f[_0x1519(0x159)]){if(_0x3c564b[_0x1519(0x27f)](_0x1519(0x280),'koJOy')){var _0x840a32;if(_0x3c564b[_0x1519(0x21e)](_0x1aeb95[_0x1519(0x4a)],_0x1519(0x5c)))_0x15be95['error'](_0x1519(0x281)+_0x4ab177+'\x20-\x20the\x20server\x20took\x20too\x20long\x20to\x20respond');else(_0x840a32=_0x1272b8[_0x1519(0x38)])!==null&&_0x840a32!==void 0x0&&_0x840a32[_0x1519(0x150)](_0x3c564b['KyiOg'])?(_0x68f8a3[_0x1519(0x39)](_0x1519(0x8f)+_0x49a925+_0x1519(0x90)),_0xde661d[_0x1519(0x39)](_0x3c564b[_0x1519(0x282)]),_0x4f3818[_0x1519(0x39)](_0x3c564b[_0x1519(0x283)]),_0x4acf71['error'](_0x3c564b['Zqjuu']),_0x43dcb4[_0x1519(0x39)](_0x3c564b[_0x1519(0x284)]),_0xbc268d[_0x1519(0x39)](_0x3c564b[_0x1519(0x285)])):_0x48388e['error']('โ\x20[OAUTH]\x20Error\x20initiating\x20OAuth\x20for\x20'+_0x59b1da+':',_0x12b5b7);return null;}else console['log'](_0x3c564b[_0x1519(0x286)]),console['log'](_0x3c564b[_0x1519(0x287)]);}else console[_0x1519(0x75)](_0x1519(0x288)),console[_0x1519(0x75)](_0x3c564b[_0x1519(0x289)],Object['keys'](_0xafdf4f)),console['warn'](_0x3c564b[_0x1519(0x28a)]);}return!![];}else return{'success':!![],'message':_0x3c564b[_0x1519(0x28b)],'details':_0x1e1363};}else{const _0x4c44f4=await _0x169c72[_0x1519(0x28c)]();return console[_0x1519(0x39)](_0x3c564b[_0x1519(0x28d)],_0x169c72[_0x1519(0x43)]),console['error'](_0x1519(0x28e)),console[_0x1519(0x39)](_0x4c44f4),![];}}}catch(_0x2828a7){if(_0x3c564b[_0x1519(0x28f)]!==_0x3c564b[_0x1519(0x290)]){console['error'](_0x3c564b['gGznt'],_0x2828a7);if(_0x3c564b[_0x1519(0x248)](_0x2828a7['code'],statusCodes[_0x1519(0x172)]))console[_0x1519(0x31)](_0x3c564b[_0x1519(0x291)]);else{if(_0x2828a7[_0x1519(0xd)]===statusCodes[_0x1519(0x175)])console[_0x1519(0x31)](_0x3c564b['EEezJ']);else{if(_0x2828a7[_0x1519(0xd)]===statusCodes[_0x1519(0x178)]){if(_0x3c564b['zNtFd'](_0x3c564b['YYJrG'],_0x3c564b[_0x1519(0x292)]))console[_0x1519(0x31)](_0x3c564b[_0x1519(0x293)]);else{const _0x2c777a={'PAnPr':function(_0x5dde78,_0x56bb63){return _0x5dde78(_0x56bb63);},'UOVGP':function(_0x2fb252,_0x24e7bb,_0x1fad31){return _0x3c564b['VisOj'](_0x2fb252,_0x24e7bb,_0x1fad31);}};return _0x5812f4['log'](_0x3c564b['ydXIq']),new _0x27c946(_0x3d52cf=>{const _0x3b1156={'rEING':_0x1519(0x1ba),'hxFqe':function(_0x51dd88,_0x40cacd){return _0x2c777a[_0x1519(0x294)](_0x51dd88,_0x40cacd);}};_0x2c777a[_0x1519(0x295)](_0x534ffe,()=>{_0x412667[_0x1519(0x31)](_0x3b1156['rEING']),_0x3b1156[_0x1519(0x296)](_0x3d52cf,!![]);},0x3e8);});}}}}return![];}else return _0x8e2b04[_0x1519(0x39)](_0x3c564b[_0x1519(0x297)]),![];}}if(_0x550964===_0x3c564b['XJpps'])return console[_0x1519(0x31)](_0x3c564b[_0x1519(0x298)]),new Promise(_0x2fc894=>{const _0x35b34f={'lKPNQ':_0x3c564b[_0x1519(0x219)],'VmZHE':function(_0x47377c,_0x2f12ad){return _0x3c564b[_0x1519(0x299)](_0x47377c,_0x2f12ad);}};_0x3c564b[_0x1519(0x29a)](setTimeout,()=>{console[_0x1519(0x31)](_0x35b34f[_0x1519(0x29b)]),_0x35b34f[_0x1519(0x29c)](_0x2fc894,!![]);},0x3e8);});return![];};export const isOAuthCallback=_0x1923a1=>{const _0x53f10a={'VLOhy':_0x1519(0x1df),'XCMOj':_0x1519(0x1e0)};return _0x1923a1['includes'](_0x53f10a['VLOhy'])||_0x1923a1[_0x1519(0x150)](_0x53f10a[_0x1519(0x29d)]);};export const exchangeCodeForToken=async(_0x9ed020,_0x4f433e)=>{const _0x14259d={'pxRzz':'โน๏ธ\x20NOTE:\x20SDK\x20does\x20not\x20create\x20users\x20during\x20YouTube\x20connection','FXVCY':_0x1519(0x1f4),'KCduf':_0x1519(0x180),'pPcIl':_0x1519(0x29e),'QUjVi':function(_0x26bd9d,_0x3115c7){return _0x26bd9d!==_0x3115c7;},'kqCXN':_0x1519(0x29f),'wvusU':_0x1519(0x2a0)};console[_0x1519(0x31)](_0x1519(0x2a1)+_0x4f433e);try{if(_0x14259d[_0x1519(0x2a2)]!==_0x1519(0x2a3)){const _0x217e58=API_CONFIG[_0x1519(0xe)]+'/'+_0x4f433e+_0x1519(0x2a4),_0x3229db=await fetch(_0x217e58,{'method':'POST','headers':{'Content-Type':'application/json'},'body':JSON[_0x1519(0x7a)]({'code':_0x9ed020,'platform':_0x4f433e})});if(!_0x3229db['ok']){if(_0x14259d[_0x1519(0x2a5)](_0x14259d[_0x1519(0x2a6)],_0x14259d['kqCXN']))_0xce93c0[_0x1519(0x31)]('โน๏ธ\x20No\x20valid\x20authentication\x20token\x20found\x20for\x20YouTube\x20connection'),_0x40f8c7[_0x1519(0x31)](_0x14259d[_0x1519(0x2a7)]),_0x5a9bf9['log'](_0x14259d[_0x1519(0x2a8)]);else{console[_0x1519(0x39)](_0x1519(0x2a9)+_0x3229db[_0x1519(0x43)]);throw new Error('Token\x20exchange\x20failed\x20with\x20status\x20'+_0x3229db[_0x1519(0x43)]);}}const _0x45a58d=await _0x3229db[_0x1519(0x10c)]();return console[_0x1519(0x31)](_0x1519(0x2aa)+_0x4f433e),_0x45a58d;}else return _0x47c840[_0x1519(0x39)](_0x14259d[_0x1519(0x2ab)]),![];}catch(_0x5e6387){return console[_0x1519(0x39)](_0x1519(0x2ac),_0x5e6387),console[_0x1519(0x31)](_0x14259d[_0x1519(0x2ad)]),{'access_token':_0x4f433e+_0x1519(0x2ae)+Math['random']()['toString'](0x24)[_0x1519(0x45)](0x7),'refresh_token':_0x4f433e+_0x1519(0x2af)+Math[_0x1519(0x2b0)]()[_0x1519(0x2b1)](0x24)[_0x1519(0x45)](0x7),'expires_in':0xe10};}};export const refreshYouTubeTokens=async()=>{const _0xa1279a={'relfc':_0x1519(0x2c),'sMmOu':_0x1519(0x2b2),'RthtJ':'โ ๏ธ\x20[YOUTUBE\x20AUTH]\x20Backend\x20did\x20not\x20confirm\x20refresh\x20token','yGrqx':_0x1519(0x205),'hWsoU':'โ ๏ธ\x20[YOUTUBE\x20AUTH]\x20Connection\x20may\x20fail\x20when\x20tokens\x20expire','bCACH':_0x1519(0x2b3),'ipomJ':_0x1519(0x2b4),'Zyddm':function(_0x3f727a,_0x1875df){return _0x3f727a===_0x1875df;},'zuAsP':function(_0x1ef1bc){return _0x1ef1bc();},'HjpeD':function(_0x54fb2f,_0x563e96){return _0x54fb2f*_0x563e96;},'TjpNY':function(_0x5782f8,_0x32032c){return _0x5782f8!==_0x32032c;},'hemHd':_0x1519(0x2b5),'TWnis':_0x1519(0x2b6),'WDtaZ':function(_0x5b7d86,_0xedfcfc){return _0x5b7d86===_0xedfcfc;},'aebda':'pixxM','MAhKO':'โ\x20Error\x20refreshing\x20YouTube\x20tokens:'};try{var _0xc16d42;console[_0x1519(0x31)](_0xa1279a[_0x1519(0x2b7)]);const _0x53a17d=await GoogleSignin[_0x1519(0x18a)]();if(!_0x53a17d)return console[_0x1519(0x39)](_0xa1279a['ipomJ']),![];const _0x4c5384=await GoogleSignin['getCurrentUser']();if(!_0x4c5384)return _0xa1279a[_0x1519(0x2b8)](_0x1519(0x2b9),_0x1519(0x2b9))?(console[_0x1519(0x39)]('โ\x20No\x20current\x20Google\x20user\x20found'),![]):{'success':![],'message':_0xa1279a[_0x1519(0x2ba)],'details':_0x241e1b};const _0x2e4238=await _0xa1279a[_0x1519(0x2bb)](getJWT);if(!_0x2e4238)return console[_0x1519(0x39)]('โ\x20No\x20auth\x20token\x20found\x20for\x20YouTube\x20refresh'),![];const _0x18bfb9=await fetch(API_CONFIG[_0x1519(0xe)]+_0x1519(0x2bc),{'method':'POST','headers':{'Content-Type':'application/json','Authorization':_0x2e4238},'body':JSON['stringify']({'accessToken':_0x53a17d[_0x1519(0xe1)],'idToken':_0x53a17d[_0x1519(0xfc)],'refreshToken':_0x4c5384['serverAuthCode'],'userEmail':_0xa1279a[_0x1519(0x2b8)](_0xc16d42=_0x4c5384[_0x1519(0xf3)],null)||_0xa1279a[_0x1519(0x2b8)](_0xc16d42,void 0x0)?void 0x0:_0xc16d42[_0x1519(0x97)],'tokenExpiry':new Date(Date[_0x1519(0x136)]()+_0xa1279a[_0x1519(0x2bd)](0xe10,0x3e8))[_0x1519(0x70)](),'timestamp':new Date()[_0x1519(0x70)]()})});if(_0x18bfb9['ok']){if(_0xa1279a['TjpNY'](_0x1519(0x2b5),_0xa1279a[_0x1519(0x2be)]))_0x5955a9['log'](_0xa1279a['sMmOu'],_0xed89a7);else{const _0x5f7581=await _0x18bfb9[_0x1519(0x10c)]();return console['log'](_0xa1279a['TWnis'],_0x5f7581),!![];}}else{const _0x56eadb=await _0x18bfb9[_0x1519(0x28c)]();return console[_0x1519(0x39)]('โ\x20YouTube\x20token\x20refresh\x20failed:',_0x18bfb9[_0x1519(0x43)],_0x56eadb),![];}}catch(_0x481bb5){if(_0xa1279a[_0x1519(0x2bf)](_0xa1279a[_0x1519(0x2c0)],_0xa1279a[_0x1519(0x2c0)]))return console[_0x1519(0x39)](_0xa1279a['MAhKO'],_0x481bb5),![];else _0x47d2fb[_0x1519(0x75)](_0xa1279a[_0x1519(0x2c1)]),_0x2a71a2[_0x1519(0x75)](_0xa1279a[_0x1519(0x2c2)],_0x4f4e6f[_0x1519(0x2c3)](_0x42535c)),_0x2d77fb[_0x1519(0x75)](_0xa1279a[_0x1519(0x2c4)]);}};const triggerTrainingRestart=async(_0x1afd31,_0x4a48fb)=>{const _0x5404fb={'PEMLJ':_0x1519(0x257),'mTsPB':_0x1519(0x1f5),'pxGeq':_0x1519(0x2b4),'sCEso':function(_0x3097e4,_0x4f3a76){return _0x3097e4===_0x4f3a76;},'FVjKD':_0x1519(0x2c5),'nDwKC':_0x1519(0x2c6),'LlvqI':_0x1519(0x2c7),'GkcWM':function(_0x487e4d,_0x4d6594,_0x30b968){return _0x487e4d(_0x4d6594,_0x30b968);},'EHNGk':_0x1519(0x2c8),'WNUpM':_0x1519(0x2c9),'ahyKK':_0x1519(0x2ca),'gdhwf':'rWEvR','zQGbp':'โ\x20[TRAINING\x20RESTART]\x20Error\x20triggering\x20training\x20restart:'};try{if(_0x5404fb['sCEso'](_0x5404fb[_0x1519(0x2cb)],_0x5404fb['nDwKC']))_0x40628d[_0x1519(0x31)](_0x5404fb[_0x1519(0x2cc)]),_0x1c3c30['log'](_0x5404fb[_0x1519(0x2cd)],_0x5c91a0[_0x1519(0x45)](0x0,0x14)+_0x1519(0xff));else{console[_0x1519(0x31)](_0x5404fb['LlvqI'],_0x1afd31);const _0x48fb9d=await _0x5404fb['GkcWM'](fetch,API_CONFIG['BASE_URL']+'/mobile-training/restart',{'method':'POST','headers':{'Content-Type':'application/json','Authorization':_0x4a48fb},'body':JSON[_0x1519(0x7a)]({'username':_0x1afd31,'reason':_0x5404fb[_0x1519(0x2ce)],'platform':_0x1519(0xc5),'timestamp':new Date()['toISOString'](),'requestNewTraining':!![]})});if(_0x48fb9d['ok']){const _0x2db24b=await _0x48fb9d[_0x1519(0x10c)]();console[_0x1519(0x31)](_0x5404fb[_0x1519(0x2cf)],_0x2db24b);}else{const _0x24df36=await _0x48fb9d['text']();console[_0x1519(0x39)](_0x5404fb['ahyKK'],_0x48fb9d[_0x1519(0x43)],_0x24df36);throw new Error(_0x1519(0x2d0)+_0x48fb9d['status']);}}}catch(_0x3b116d){if(_0x5404fb[_0x1519(0x2d1)](_0x5404fb[_0x1519(0x2d2)],_0x5404fb[_0x1519(0x2d2)])){console[_0x1519(0x39)](_0x5404fb['zQGbp'],_0x3b116d);throw _0x3b116d;}else return _0x133165[_0x1519(0x39)](_0x5404fb[_0x1519(0x2d3)]),![];}};export const testYouTubeRefreshToken=async _0x344c75=>{const _0xe6abd1={'PoCWU':_0x1519(0x2d4),'XMDYm':_0x1519(0x2d5),'OlQpr':_0x1519(0x2d6),'YgqZb':_0x1519(0x2d7),'jmejj':function(_0x5a7e2f){return _0x5a7e2f();},'BkSvd':_0x1519(0x2d8),'rIWuC':_0x1519(0x2d9),'kwJIy':function(_0x4d2b35,_0x4b3262){return _0x4d2b35!==_0x4b3262;},'isPAn':_0x1519(0x2da),'gaSnJ':_0x1519(0x2db),'cJuXA':_0x1519(0x2dc)};console[_0x1519(0x31)](_0xe6abd1['XMDYm']),console['log']('๐ค\x20User:',_0x344c75);try{if(_0xe6abd1[_0x1519(0x2dd)]===_0xe6abd1[_0x1519(0x2de)])_0x1cbb40[_0x1519(0x31)](_0xe6abd1[_0x1519(0x2df)],_0x299161);else{const _0x36fb1f=await _0xe6abd1['jmejj'](debugYouTubeTokens);console[_0x1519(0x31)](_0xe6abd1[_0x1519(0x2e0)],_0x36fb1f);if(!_0x36fb1f[_0x1519(0x158)]){console[_0x1519(0x31)](_0xe6abd1[_0x1519(0x2e1)]);const _0x5952eb=await fixUserYouTubeConnection(_0x344c75);if(_0x5952eb){if(_0xe6abd1[_0x1519(0x2e2)](_0x1519(0x2e3),_0x1519(0x2e3)))_0x320f80[_0x1519(0x42)]={'success':![],'error':_0x2340dd[_0x1519(0x38)],'name':_0xfd72b0[_0x1519(0x4a)]},_0x2c01e7[_0x1519(0x39)](_0x1519(0x2a),_0xe3fe89[_0x1519(0x38)]);else{console[_0x1519(0x31)](_0xe6abd1[_0x1519(0x2e4)]);const _0x39c934=await debugYouTubeTokens();console[_0x1519(0x31)](_0x1519(0x2e5),_0x39c934);}}else console[_0x1519(0x39)](_0xe6abd1[_0x1519(0x2e6)]);}else console[_0x1519(0x31)](_0xe6abd1[_0x1519(0x2e7)]);}}catch(_0x5980e3){console[_0x1519(0x39)](_0x1519(0x2e8),_0x5980e3);}};export const requestEmailVerification=async(_0x51b68f,_0x3f4b71=![])=>{const _0x4785c6={'BnXyr':_0x1519(0x2e9),'UPvyw':_0x1519(0x2ea),'LNhmj':_0x1519(0x2eb),'hIrUa':function(_0x2d46ea){return _0x2d46ea();},'wCTZl':'Verification\x20code\x20sent\x20to\x20your\x20email','WMJZd':_0x1519(0x2ec),'tImge':_0x1519(0x2ed),'elTCg':_0x1519(0x2ee)};try{console['log'](_0x4785c6[_0x1519(0x2ef)],_0x51b68f);const _0x196e29=await fetch(API_CONFIG[_0x1519(0xe)]+_0x1519(0x2f0),{'method':'POST','headers':_0x4785c6[_0x1519(0x2f1)](getDeveloperAuthHeaders),'body':JSON[_0x1519(0x7a)]({'email':_0x51b68f,'action':_0x1519(0x2f2),'testMode':_0x3f4b71})}),_0x123a39=await _0x196e29[_0x1519(0x10c)]();return _0x196e29['ok']?{'success':!![],'message':_0x123a39[_0x1519(0x38)]||_0x4785c6[_0x1519(0x2f3)]}:_0x4785c6['WMJZd']===_0x4785c6[_0x1519(0x2f4)]?(_0x1d1e12[_0x1519(0x39)](_0x4785c6[_0x1519(0x2f5)],_0x5d99d0),{'success':![],'error':_0x4785c6[_0x1519(0x2f6)]}):{'success':![],'error':_0x123a39['message']||_0x1519(0x27e)};}catch(_0x148208){return console[_0x1519(0x39)](_0x4785c6[_0x1519(0x2f7)],_0x148208),{'success':![],'error':_0x1519(0x2ea)};}};export const verifyEmailCode=async(_0x685ae8,_0x310c09,_0x89d63b=![])=>{const _0x800ddb={'efTnK':_0x1519(0x1c2),'Xvqht':'โ
\x20SUCCESS:\x20Got\x20refresh\x20token\x20after\x20REVOKE\x20+\x20consent!','VJyoC':_0x1519(0xbb),'KwdLs':_0x1519(0x10),'trEHM':_0x1519(0xb1),'TidcS':_0x1519(0x9a),'vROXO':_0x1519(0x97),'CcpJZ':function(_0x2fac17,_0x3693a5){return _0x2fac17===_0x3693a5;},'VqwrW':_0x1519(0x2f8),'rMUcW':_0x1519(0x2f9),'HVxOC':function(_0x20d820,_0x1d57ba){return _0x20d820===_0x1d57ba;},'RetEz':_0x1519(0x2fa),'ZnsaO':function(_0x1aea8f,_0x2b7ef9){return _0x1aea8f===_0x2b7ef9;},'QTITL':_0x1519(0x2fb),'mTrVK':_0x1519(0x2ea)};try{if(_0x800ddb[_0x1519(0x2fc)](_0x1519(0x2fd),_0x1519(0x2fe)))_0x288c7e[_0x1519(0x31)](_0x800ddb['efTnK'],_0x1266bf[_0x1519(0x139)]);else{console['log'](_0x800ddb[_0x1519(0x2ff)],_0x685ae8);const _0x207250=await fetch(API_CONFIG['BASE_URL']+_0x1519(0x2f0),{'method':'POST','headers':getDeveloperAuthHeaders(),'body':JSON[_0x1519(0x7a)]({'email':_0x685ae8,'code':_0x310c09,'action':_0x800ddb[_0x1519(0x300)],'testMode':_0x89d63b})}),_0x227e00=await _0x207250[_0x1519(0x10c)]();return _0x207250['ok']?_0x800ddb[_0x1519(0x301)](_0x800ddb[_0x1519(0x302)],_0x800ddb[_0x1519(0x302)])?{'success':!![],'message':_0x227e00[_0x1519(0x38)]||'Email\x20verified\x20successfully','existingUser':_0x227e00[_0x1519(0x121)]||![],'token':_0x227e00['token']}:(_0x4c0c4e['log'](_0x800ddb[_0x1519(0x303)]),_0x42d5ba[_0x1519(0x31)](_0x800ddb[_0x1519(0x304)],_0x3d2f7e[_0x1519(0x45)](0x0,0x14)+_0x1519(0xff)),!![]):{'success':![],'error':_0x227e00[_0x1519(0x38)]||_0x1519(0x20)};}}catch(_0x224212){if(_0x800ddb[_0x1519(0x305)](_0x800ddb[_0x1519(0x306)],_0x800ddb['QTITL']))return console[_0x1519(0x39)](_0x1519(0x2e9),_0x224212),{'success':![],'error':_0x800ddb[_0x1519(0x307)]};else GoogleSignin['configure']({'webClientId':_0x4ed90c,'iosClientId':_0x2e8a41,'offlineAccess':!![],'forceCodeForRefreshToken':!![],'scopes':[_0x800ddb[_0x1519(0x308)],_0x800ddb[_0x1519(0x309)],_0x800ddb[_0x1519(0x30a)],_0x800ddb[_0x1519(0x30b)]],'hostedDomain':'','accountName':''});}};export const checkEmailVerificationStatus=async(_0x2b4db0,_0x5de2e1=![])=>{const _0x4e521b={'eNhQM':function(_0x568b70,_0x53b399,_0x3558da){return _0x568b70(_0x53b399,_0x3558da);},'lIoEv':function(_0xcecbf2){return _0xcecbf2();},'WbOGz':_0x1519(0x30c),'OqJAj':'Network\x20error'};try{const _0x20722e=await _0x4e521b[_0x1519(0x30d)](fetch,API_CONFIG[_0x1519(0xe)]+'/email/verification/status',{'method':'POST','headers':_0x4e521b[_0x1519(0x30e)](getDeveloperAuthHeaders),'body':JSON[_0x1519(0x7a)]({'email':_0x2b4db0,'testMode':_0x5de2e1})}),_0x1811fd=await _0x20722e['json']();return{'success':_0x20722e['ok'],'isPending':_0x1811fd['isPending']||![],'message':_0x1811fd[_0x1519(0x38)]};}catch(_0x429c49){return console[_0x1519(0x39)](_0x4e521b[_0x1519(0x30f)],_0x429c49),{'success':![],'isPending':![],'error':_0x4e521b[_0x1519(0x310)]};}};export const initializePlatformAuthService=()=>{const _0x37e6be={'oLfsQ':_0x1519(0x311)};console[_0x1519(0x31)](_0x37e6be[_0x1519(0x312)]),initializeGoogleSignIn();};
|
|
1
|
+
/**
|
|
2
|
+
* Platform Authentication Service
|
|
3
|
+
* Handles OAuth flows for different platforms
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { Platform } from 'react-native';
|
|
7
|
+
import { GoogleSignin, statusCodes } from '@react-native-google-signin/google-signin';
|
|
8
|
+
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
9
|
+
import { API_CONFIG, getApiHeaders, getUserAuthHeaders } from '../config/api';
|
|
10
|
+
import { getApiConfig, isApiKeyInitialized } from './apiKeyService';
|
|
11
|
+
// CRITICAL FIX: Use static imports to avoid Hermes transpilation issues
|
|
12
|
+
import { getJWT } from './jwtStorageService';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Get developer API key authorization headers
|
|
16
|
+
* This ensures all auth requests include the developer's API key for backend validation
|
|
17
|
+
* @throws Error if SDK is not initialized with a valid API key
|
|
18
|
+
*/
|
|
19
|
+
const getDeveloperAuthHeaders = () => {
|
|
20
|
+
if (!isApiKeyInitialized()) {
|
|
21
|
+
throw new Error('SDK not initialized. Developers must call initializeApiKey() before using auth features.');
|
|
22
|
+
}
|
|
23
|
+
const config = getApiConfig();
|
|
24
|
+
if (!(config !== null && config !== void 0 && config.apiKey)) {
|
|
25
|
+
throw new Error('No API key configured. Please initialize the SDK with a valid developer API key.');
|
|
26
|
+
}
|
|
27
|
+
return {
|
|
28
|
+
...getApiHeaders(),
|
|
29
|
+
'Authorization': `Bearer ${config.apiKey}`,
|
|
30
|
+
'X-SDK-Version': '3.0.72',
|
|
31
|
+
'X-SDK-Platform': 'react-native'
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
// ๐ CRITICAL: Using the same client ID for both web and iOS to avoid audience errors
|
|
36
|
+
const WEB_CLIENT_ID = '1030678346906-lovkuds2ouqmoc8eu5qpo98spa6edv4o.apps.googleusercontent.com';
|
|
37
|
+
const IOS_CLIENT_ID = '1030678346906-lovkuds2ouqmoc8eu5qpo98spa6edv4o.apps.googleusercontent.com';
|
|
38
|
+
// OAuth configuration for different platforms
|
|
39
|
+
const OAUTH_CONFIG = {
|
|
40
|
+
instagram: {
|
|
41
|
+
authUrl: 'https://api.instagram.com/oauth/authorize',
|
|
42
|
+
clientId: 'demo_instagram_client_id',
|
|
43
|
+
redirectUri: 'onairosevents://auth/callback',
|
|
44
|
+
scope: 'user_profile,user_media',
|
|
45
|
+
responseType: 'code',
|
|
46
|
+
hasNativeSDK: false
|
|
47
|
+
},
|
|
48
|
+
youtube: {
|
|
49
|
+
authUrl: `${API_CONFIG.BASE_URL}/youtube/authorize`,
|
|
50
|
+
clientId: '1030678346906-lovkuds2ouqmoc8eu5qpo98spa6edv4o.apps.googleusercontent.com',
|
|
51
|
+
redirectUri: 'onairosevents://auth/callback',
|
|
52
|
+
scope: 'https://www.googleapis.com/auth/youtube.readonly',
|
|
53
|
+
responseType: 'code',
|
|
54
|
+
hasNativeSDK: true // Changed to true for native SDK
|
|
55
|
+
},
|
|
56
|
+
reddit: {
|
|
57
|
+
authUrl: `${API_CONFIG.BASE_URL}/reddit/authorize`,
|
|
58
|
+
clientId: 'demo_reddit_client_id',
|
|
59
|
+
redirectUri: 'onairosevents://auth/callback',
|
|
60
|
+
scope: 'identity,read',
|
|
61
|
+
responseType: 'code',
|
|
62
|
+
hasNativeSDK: false
|
|
63
|
+
},
|
|
64
|
+
pinterest: {
|
|
65
|
+
authUrl: `${API_CONFIG.BASE_URL}/pinterest/authorize`,
|
|
66
|
+
clientId: 'demo_pinterest_client_id',
|
|
67
|
+
redirectUri: 'onairosevents://auth/callback',
|
|
68
|
+
scope: 'boards:read,pins:read',
|
|
69
|
+
responseType: 'code',
|
|
70
|
+
hasNativeSDK: false
|
|
71
|
+
},
|
|
72
|
+
facebook: {
|
|
73
|
+
authUrl: 'https://www.facebook.com/v12.0/dialog/oauth',
|
|
74
|
+
clientId: 'demo_facebook_client_id',
|
|
75
|
+
redirectUri: 'onairosevents://auth/callback',
|
|
76
|
+
scope: 'public_profile,email',
|
|
77
|
+
responseType: 'code',
|
|
78
|
+
hasNativeSDK: false
|
|
79
|
+
},
|
|
80
|
+
// GitHub connector is temporarily commented out
|
|
81
|
+
// github: {
|
|
82
|
+
// authUrl: 'https://github.com/login/oauth/authorize',
|
|
83
|
+
// clientId: 'demo_github_client_id',
|
|
84
|
+
// redirectUri: 'onairosevents://auth/callback',
|
|
85
|
+
// scope: 'repo,user',
|
|
86
|
+
// responseType: 'code',
|
|
87
|
+
// hasNativeSDK: false
|
|
88
|
+
// },
|
|
89
|
+
linkedin: {
|
|
90
|
+
authUrl: `${API_CONFIG.BASE_URL}/linkedin/authorize`,
|
|
91
|
+
clientId: '',
|
|
92
|
+
// No client ID needed - backend handles OAuth
|
|
93
|
+
redirectUri: 'onairosevents://auth/callback',
|
|
94
|
+
scope: 'openid profile email',
|
|
95
|
+
// Updated to OpenID Connect scopes as per your backend
|
|
96
|
+
responseType: 'code',
|
|
97
|
+
hasNativeSDK: false // LinkedIn has no modern native SDK
|
|
98
|
+
},
|
|
99
|
+
gmail: {
|
|
100
|
+
authUrl: `${API_CONFIG.BASE_URL}/gmail/authorize`,
|
|
101
|
+
clientId: 'demo_gmail_client_id',
|
|
102
|
+
redirectUri: 'onairosevents://auth/callback',
|
|
103
|
+
scope: 'https://www.googleapis.com/auth/gmail.readonly',
|
|
104
|
+
responseType: 'code',
|
|
105
|
+
hasNativeSDK: false
|
|
106
|
+
},
|
|
107
|
+
email: {
|
|
108
|
+
// Email doesn't use OAuth but we still need to handle it in the flow
|
|
109
|
+
hasNativeSDK: false,
|
|
110
|
+
authUrl: `${API_CONFIG.BASE_URL}/email/authorize` // Proxy endpoint for email verification
|
|
111
|
+
},
|
|
112
|
+
// LLM Platforms - use direct login URLs (WebView handles extraction)
|
|
113
|
+
// These platforms use WebView-based login + JavaScript injection for data export
|
|
114
|
+
chatgpt: {
|
|
115
|
+
authUrl: 'https://chat.openai.com',
|
|
116
|
+
// Direct login URL - WebView injects export scripts
|
|
117
|
+
clientId: '',
|
|
118
|
+
redirectUri: '',
|
|
119
|
+
scope: '',
|
|
120
|
+
responseType: '',
|
|
121
|
+
hasNativeSDK: false
|
|
122
|
+
},
|
|
123
|
+
claude: {
|
|
124
|
+
authUrl: 'https://claude.ai/login',
|
|
125
|
+
// Direct login URL - WebView injects export scripts
|
|
126
|
+
clientId: '',
|
|
127
|
+
redirectUri: '',
|
|
128
|
+
scope: '',
|
|
129
|
+
responseType: '',
|
|
130
|
+
hasNativeSDK: false
|
|
131
|
+
},
|
|
132
|
+
gemini: {
|
|
133
|
+
authUrl: 'https://gemini.google.com',
|
|
134
|
+
// Direct login URL - WebView injects export scripts
|
|
135
|
+
clientId: '',
|
|
136
|
+
redirectUri: '',
|
|
137
|
+
scope: '',
|
|
138
|
+
responseType: '',
|
|
139
|
+
hasNativeSDK: false
|
|
140
|
+
},
|
|
141
|
+
grok: {
|
|
142
|
+
authUrl: 'https://x.com/i/grok',
|
|
143
|
+
// Direct login URL (via X) - WebView injects export scripts
|
|
144
|
+
clientId: '',
|
|
145
|
+
redirectUri: '',
|
|
146
|
+
scope: '',
|
|
147
|
+
responseType: '',
|
|
148
|
+
hasNativeSDK: false
|
|
149
|
+
},
|
|
150
|
+
// ============================================================
|
|
151
|
+
// NEW PLATFORMS - WebView-based extraction
|
|
152
|
+
// API endpoints are PLACEHOLDERS - fill in once known
|
|
153
|
+
// ============================================================
|
|
154
|
+
hinge: {
|
|
155
|
+
authUrl: 'https://hinge.co',
|
|
156
|
+
// PLACEHOLDER - may need mobile web URL
|
|
157
|
+
clientId: '',
|
|
158
|
+
redirectUri: '',
|
|
159
|
+
scope: '',
|
|
160
|
+
responseType: '',
|
|
161
|
+
hasNativeSDK: false
|
|
162
|
+
},
|
|
163
|
+
// Instagram WebView extraction (different from OAuth Instagram)
|
|
164
|
+
instagram_webview: {
|
|
165
|
+
authUrl: 'https://www.instagram.com',
|
|
166
|
+
// Direct login - WebView injects export scripts
|
|
167
|
+
clientId: '',
|
|
168
|
+
redirectUri: '',
|
|
169
|
+
scope: '',
|
|
170
|
+
responseType: '',
|
|
171
|
+
hasNativeSDK: false
|
|
172
|
+
},
|
|
173
|
+
sephora: {
|
|
174
|
+
authUrl: 'https://www.sephora.com',
|
|
175
|
+
// Direct login - WebView injects export scripts
|
|
176
|
+
clientId: '',
|
|
177
|
+
redirectUri: '',
|
|
178
|
+
scope: '',
|
|
179
|
+
responseType: '',
|
|
180
|
+
hasNativeSDK: false
|
|
181
|
+
},
|
|
182
|
+
// ============================================================
|
|
183
|
+
// TELEGRAM - MTProto API WebView-based extraction
|
|
184
|
+
// Uses web.telegram.org/k/ for login, extracts via IndexedDB
|
|
185
|
+
//
|
|
186
|
+
// MTProto API methods used:
|
|
187
|
+
// - messages.getDialogs: Get user's chat list
|
|
188
|
+
// - messages.getHistory: Get messages from a chat
|
|
189
|
+
//
|
|
190
|
+
// Backend should use Telethon/Pyrogram/TDLib for full API access
|
|
191
|
+
// @see https://core.telegram.org/api
|
|
192
|
+
// ============================================================
|
|
193
|
+
telegram: {
|
|
194
|
+
authUrl: 'https://web.telegram.org/k/',
|
|
195
|
+
// Telegram Web K - WebView injects export scripts
|
|
196
|
+
clientId: '',
|
|
197
|
+
// Not used - MTProto uses api_id/api_hash
|
|
198
|
+
redirectUri: '',
|
|
199
|
+
scope: '',
|
|
200
|
+
responseType: '',
|
|
201
|
+
hasNativeSDK: false
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Check if the platform has a native SDK
|
|
207
|
+
*/
|
|
208
|
+
export const hasNativeSDK = platform => {
|
|
209
|
+
var _OAUTH_CONFIG$platfor;
|
|
210
|
+
return ((_OAUTH_CONFIG$platfor = OAUTH_CONFIG[platform]) === null || _OAUTH_CONFIG$platfor === void 0 ? void 0 : _OAUTH_CONFIG$platfor.hasNativeSDK) || false;
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Test API connectivity before making OAuth requests
|
|
215
|
+
*/
|
|
216
|
+
export const testApiConnectivity = async () => {
|
|
217
|
+
const results = {
|
|
218
|
+
googleTest: null,
|
|
219
|
+
api2Test: null
|
|
220
|
+
};
|
|
221
|
+
try {
|
|
222
|
+
var _results$api2Test, _results$googleTest;
|
|
223
|
+
console.log('๐ [CONNECTIVITY] Running comprehensive network diagnostics...');
|
|
224
|
+
|
|
225
|
+
// Test 1: Can we reach Google? (known good endpoint)
|
|
226
|
+
console.log('๐ [CONNECTIVITY] Test 1: Checking general internet (google.com)...');
|
|
227
|
+
try {
|
|
228
|
+
const googleResponse = await fetch('https://www.google.com', {
|
|
229
|
+
method: 'HEAD',
|
|
230
|
+
// @ts-ignore - mode not always available in React Native
|
|
231
|
+
mode: 'no-cors'
|
|
232
|
+
});
|
|
233
|
+
results.googleTest = {
|
|
234
|
+
success: true,
|
|
235
|
+
status: 'reachable'
|
|
236
|
+
};
|
|
237
|
+
console.log('โ
[CONNECTIVITY] Google is reachable - internet is working');
|
|
238
|
+
} catch (googleError) {
|
|
239
|
+
results.googleTest = {
|
|
240
|
+
success: false,
|
|
241
|
+
error: googleError.message
|
|
242
|
+
};
|
|
243
|
+
console.error('โ [CONNECTIVITY] Cannot reach Google - internet may be down:', googleError.message);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
// Test 2: Can we reach API server?
|
|
247
|
+
console.log('๐ [CONNECTIVITY] Test 2: Checking API server...');
|
|
248
|
+
try {
|
|
249
|
+
const controller = new AbortController();
|
|
250
|
+
const timeoutId = setTimeout(() => controller.abort(), 30000); // Increased to 30s for simulator
|
|
251
|
+
|
|
252
|
+
const response = await fetch(`${API_CONFIG.BASE_URL}/health`, {
|
|
253
|
+
method: 'GET',
|
|
254
|
+
signal: controller.signal
|
|
255
|
+
});
|
|
256
|
+
clearTimeout(timeoutId);
|
|
257
|
+
const responseText = await response.text().catch(() => 'Unable to read response');
|
|
258
|
+
results.api2Test = {
|
|
259
|
+
success: response.ok,
|
|
260
|
+
status: response.status,
|
|
261
|
+
statusText: response.statusText,
|
|
262
|
+
response: responseText.substring(0, 200) // First 200 chars
|
|
263
|
+
};
|
|
264
|
+
if (response.ok) {
|
|
265
|
+
console.log('โ
[CONNECTIVITY] API server is reachable');
|
|
266
|
+
} else {
|
|
267
|
+
console.log(`โ ๏ธ [CONNECTIVITY] API server responded with status: ${response.status}`);
|
|
268
|
+
}
|
|
269
|
+
} catch (apiError) {
|
|
270
|
+
results.api2Test = {
|
|
271
|
+
success: false,
|
|
272
|
+
error: apiError.message,
|
|
273
|
+
name: apiError.name
|
|
274
|
+
};
|
|
275
|
+
console.error('โ [CONNECTIVITY] Cannot reach API server:', apiError.message);
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
// Determine overall result
|
|
279
|
+
if ((_results$api2Test = results.api2Test) !== null && _results$api2Test !== void 0 && _results$api2Test.success) {
|
|
280
|
+
return {
|
|
281
|
+
success: true,
|
|
282
|
+
message: 'API is reachable',
|
|
283
|
+
details: results
|
|
284
|
+
};
|
|
285
|
+
} else if ((_results$googleTest = results.googleTest) !== null && _results$googleTest !== void 0 && _results$googleTest.success) {
|
|
286
|
+
return {
|
|
287
|
+
success: false,
|
|
288
|
+
message: 'Internet works but API server is unreachable. The server may be blocking requests from this device/simulator.',
|
|
289
|
+
details: results
|
|
290
|
+
};
|
|
291
|
+
} else {
|
|
292
|
+
return {
|
|
293
|
+
success: false,
|
|
294
|
+
message: 'No internet connectivity detected. Check your network connection.',
|
|
295
|
+
details: results
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
} catch (error) {
|
|
299
|
+
console.error('โ [CONNECTIVITY] Connectivity test failed:', error.message);
|
|
300
|
+
return {
|
|
301
|
+
success: false,
|
|
302
|
+
message: `Network error: ${error.message}`,
|
|
303
|
+
details: {
|
|
304
|
+
error: error.message,
|
|
305
|
+
results
|
|
306
|
+
}
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
};
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* Initiate OAuth flow for a platform
|
|
313
|
+
* Uses User JWT for authentication (TIER 2)
|
|
314
|
+
*/
|
|
315
|
+
export const initiateOAuth = async (platform, _username) => {
|
|
316
|
+
try {
|
|
317
|
+
console.log(`๐ [OAUTH] Starting OAuth for platform: ${platform}`);
|
|
318
|
+
console.log(`๐ฑ [OAUTH] Platform: ${Platform.OS}, Version: ${Platform.Version}`);
|
|
319
|
+
|
|
320
|
+
// For platforms that don't need OAuth (like email), handle differently
|
|
321
|
+
if (platform === 'email') {
|
|
322
|
+
console.log('๐ง [OAUTH] Email platform selected, returning mock auth URL');
|
|
323
|
+
return `${API_CONFIG.BASE_URL}/email/authorize?action=verify`;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
// Get user JWT headers - user must be authenticated
|
|
327
|
+
let authHeaders;
|
|
328
|
+
try {
|
|
329
|
+
authHeaders = await getUserAuthHeaders();
|
|
330
|
+
console.log(`๐ [OAUTH] Using User JWT for authentication`);
|
|
331
|
+
} catch (authError) {
|
|
332
|
+
console.error(`โ [OAUTH] User not authenticated - cannot initiate ${platform} OAuth`);
|
|
333
|
+
console.error(`โ [OAUTH] Please log in first before connecting platforms`);
|
|
334
|
+
return null;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
// Construct the proxy URL
|
|
338
|
+
const proxyUrl = `${API_CONFIG.BASE_URL}/${platform}/authorize`;
|
|
339
|
+
console.log(`๐ [OAUTH] Proxy URL: ${proxyUrl}`);
|
|
340
|
+
console.log(`๐ [OAUTH] About to make fetch request...`);
|
|
341
|
+
|
|
342
|
+
// Request body - no username needed, backend extracts from JWT
|
|
343
|
+
const requestBody = {
|
|
344
|
+
platform: platform,
|
|
345
|
+
timestamp: new Date().toISOString()
|
|
346
|
+
};
|
|
347
|
+
console.log(`๐ค [OAUTH] Request body:`, requestBody);
|
|
348
|
+
|
|
349
|
+
// Add timeout to prevent hanging requests
|
|
350
|
+
const controller = new AbortController();
|
|
351
|
+
const timeoutId = setTimeout(() => {
|
|
352
|
+
console.log(`โฐ [OAUTH] Request timeout for ${platform} - aborting`);
|
|
353
|
+
controller.abort();
|
|
354
|
+
}, 30000); // 30 second timeout for simulator compatibility
|
|
355
|
+
|
|
356
|
+
// Make a POST request to the proxy
|
|
357
|
+
// ๐ SECURITY: Uses User JWT - backend extracts username from token
|
|
358
|
+
const response = await fetch(proxyUrl, {
|
|
359
|
+
method: 'POST',
|
|
360
|
+
headers: authHeaders,
|
|
361
|
+
body: JSON.stringify(requestBody),
|
|
362
|
+
signal: controller.signal
|
|
363
|
+
});
|
|
364
|
+
clearTimeout(timeoutId);
|
|
365
|
+
console.log(`๐ก [OAUTH] Response status: ${response.status} ${response.statusText}`);
|
|
366
|
+
if (!response.ok) {
|
|
367
|
+
const errorText = await response.text();
|
|
368
|
+
console.error(`โ [OAUTH] Error initiating OAuth for ${platform}: ${response.status} - ${errorText}`);
|
|
369
|
+
return null;
|
|
370
|
+
}
|
|
371
|
+
const data = await response.json();
|
|
372
|
+
console.log(`๐ [OAUTH] Response data for ${platform}:`, data);
|
|
373
|
+
|
|
374
|
+
// Get the authorization URL from the response
|
|
375
|
+
// Different platforms might use different keys (e.g., pinterestURL, youtubeURL)
|
|
376
|
+
const urlKey = `${platform}URL`;
|
|
377
|
+
const authUrl = data[urlKey] || data.url || null;
|
|
378
|
+
console.log(`๐ [OAUTH] Auth URL for ${platform} (key: ${urlKey}):`, authUrl);
|
|
379
|
+
return authUrl;
|
|
380
|
+
} catch (error) {
|
|
381
|
+
var _error$message;
|
|
382
|
+
// Enhanced error logging
|
|
383
|
+
if (error.name === 'AbortError') {
|
|
384
|
+
console.error(`โ [OAUTH] Request timeout for ${platform} - the server took too long to respond`);
|
|
385
|
+
} else if ((_error$message = error.message) !== null && _error$message !== void 0 && _error$message.includes('Network request failed')) {
|
|
386
|
+
console.error(`โ [OAUTH] Network request failed for ${platform}. Possible causes:`);
|
|
387
|
+
console.error(' 1. No internet connection on device/simulator');
|
|
388
|
+
console.error(' 2. API server (API server) is unreachable');
|
|
389
|
+
console.error(' 3. DNS resolution failed');
|
|
390
|
+
console.error(' 4. SSL/TLS certificate issue');
|
|
391
|
+
console.error(' 5. iOS simulator network sandbox issue - try on physical device');
|
|
392
|
+
} else {
|
|
393
|
+
console.error(`โ [OAUTH] Error initiating OAuth for ${platform}:`, error);
|
|
394
|
+
}
|
|
395
|
+
return null;
|
|
396
|
+
}
|
|
397
|
+
};
|
|
398
|
+
|
|
399
|
+
/**
|
|
400
|
+
* Initialize Google Sign-In configuration with enhanced refresh token support
|
|
401
|
+
* Updated with CRITICAL parameters for refresh token generation
|
|
402
|
+
*/
|
|
403
|
+
const initializeGoogleSignIn = () => {
|
|
404
|
+
GoogleSignin.configure({
|
|
405
|
+
webClientId: WEB_CLIENT_ID,
|
|
406
|
+
// โ
CRITICAL: Web client ID for refresh tokens
|
|
407
|
+
iosClientId: IOS_CLIENT_ID,
|
|
408
|
+
// โ
iOS client ID for native auth
|
|
409
|
+
|
|
410
|
+
// ๐ CRITICAL: These parameters are REQUIRED for refresh tokens
|
|
411
|
+
offlineAccess: true,
|
|
412
|
+
// โ CRITICAL: Enables refresh tokens
|
|
413
|
+
forceCodeForRefreshToken: true,
|
|
414
|
+
// โ CRITICAL: Forces refresh token generation
|
|
415
|
+
|
|
416
|
+
// โ
Enhanced scopes for YouTube
|
|
417
|
+
scopes: ['https://www.googleapis.com/auth/youtube.readonly', 'openid', 'profile', 'email'],
|
|
418
|
+
// โ
Clear settings to avoid conflicts
|
|
419
|
+
hostedDomain: '',
|
|
420
|
+
accountName: ''
|
|
421
|
+
});
|
|
422
|
+
};
|
|
423
|
+
|
|
424
|
+
/**
|
|
425
|
+
* Force YouTube reconnection with consent screen to get refresh tokens
|
|
426
|
+
* This is the key function to fix YouTube token expiry issues
|
|
427
|
+
*/
|
|
428
|
+
export const forceYouTubeReconnectionWithConsent = async username => {
|
|
429
|
+
try {
|
|
430
|
+
var _userInfo$data, _userInfo$data2, _userInfo$data3;
|
|
431
|
+
console.log('๐ FORCING fresh YouTube consent for refresh token...');
|
|
432
|
+
console.log('๐ค User:', username);
|
|
433
|
+
|
|
434
|
+
// Step 1: โ
CRITICAL: Complete sign out (clears all cached consent)
|
|
435
|
+
try {
|
|
436
|
+
await GoogleSignin.signOut();
|
|
437
|
+
console.log('โ
Signed out - consent cache cleared');
|
|
438
|
+
} catch (signOutError) {
|
|
439
|
+
console.log('โน๏ธ Sign out not needed:', signOutError);
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
// Step 2: โ
CRITICAL: Clear cached tokens if available
|
|
443
|
+
try {
|
|
444
|
+
const existingTokens = await GoogleSignin.getTokens();
|
|
445
|
+
if (existingTokens.accessToken) {
|
|
446
|
+
await GoogleSignin.clearCachedAccessToken(existingTokens.accessToken);
|
|
447
|
+
console.log('โ
Token cache cleared');
|
|
448
|
+
}
|
|
449
|
+
} catch (clearError) {
|
|
450
|
+
console.log('โน๏ธ No token cache to clear');
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
// Step 3: โ
CRITICAL: Configure Google Sign-In for FORCED consent
|
|
454
|
+
console.log('๐ง Configuring Google Sign-In for forced consent...');
|
|
455
|
+
GoogleSignin.configure({
|
|
456
|
+
webClientId: WEB_CLIENT_ID,
|
|
457
|
+
// โ
CRITICAL: Web client ID for refresh tokens
|
|
458
|
+
iosClientId: IOS_CLIENT_ID,
|
|
459
|
+
// โ
iOS client ID for native auth
|
|
460
|
+
|
|
461
|
+
// ๐ FORCE REFRESH TOKEN SETTINGS:
|
|
462
|
+
offlineAccess: true,
|
|
463
|
+
// Request offline access
|
|
464
|
+
forceCodeForRefreshToken: true,
|
|
465
|
+
// Force refresh token generation
|
|
466
|
+
|
|
467
|
+
// ๐ FORCE CONSENT SCREEN:
|
|
468
|
+
scopes: ['https://www.googleapis.com/auth/youtube.readonly', 'openid', 'profile', 'email'],
|
|
469
|
+
// โ
CRITICAL: Clear settings to force fresh consent
|
|
470
|
+
hostedDomain: '',
|
|
471
|
+
accountName: ''
|
|
472
|
+
});
|
|
473
|
+
|
|
474
|
+
// Step 4: โ
Check Play Services
|
|
475
|
+
await GoogleSignin.hasPlayServices();
|
|
476
|
+
console.log('โ
Play Services available');
|
|
477
|
+
|
|
478
|
+
// Step 5: โ
CRITICAL: Sign in (this SHOULD show consent screen)
|
|
479
|
+
console.log('๐ Initiating sign-in - consent screen should appear...');
|
|
480
|
+
console.log('๐ฑ User should see: "Allow [App] to access your YouTube account when you\'re not using the app?"');
|
|
481
|
+
const userInfo = await GoogleSignin.signIn();
|
|
482
|
+
console.log('โ
Sign-in completed - checking for refresh token...');
|
|
483
|
+
console.log('๐ค User email:', (_userInfo$data = userInfo.data) === null || _userInfo$data === void 0 || (_userInfo$data = _userInfo$data.user) === null || _userInfo$data === void 0 ? void 0 : _userInfo$data.email);
|
|
484
|
+
|
|
485
|
+
// Step 6: โ
Get tokens after consent
|
|
486
|
+
const tokens = await GoogleSignin.getTokens();
|
|
487
|
+
const currentUser = await GoogleSignin.getCurrentUser();
|
|
488
|
+
console.log('๐ FULL userInfo object from forceYouTubeReconnectionWithConsent:');
|
|
489
|
+
console.log(JSON.stringify(userInfo, null, 2));
|
|
490
|
+
console.log('๐ FULL tokens object from forceYouTubeReconnectionWithConsent:');
|
|
491
|
+
console.log(JSON.stringify(tokens, null, 2));
|
|
492
|
+
console.log('๐ FULL currentUser object from forceYouTubeReconnectionWithConsent:');
|
|
493
|
+
console.log(JSON.stringify(currentUser, null, 2));
|
|
494
|
+
console.log('๐ Token analysis:');
|
|
495
|
+
console.log('- Access token:', tokens.accessToken ? `${tokens.accessToken.substring(0, 20)}...` : 'Missing');
|
|
496
|
+
console.log('- ID token:', tokens.idToken ? 'Present' : 'Missing');
|
|
497
|
+
console.log('- ServerAuthCode (userInfo):', (_userInfo$data2 = userInfo.data) !== null && _userInfo$data2 !== void 0 && _userInfo$data2.serverAuthCode ? `${userInfo.data.serverAuthCode.substring(0, 20)}...` : 'Missing');
|
|
498
|
+
console.log('- ServerAuthCode (currentUser):', currentUser !== null && currentUser !== void 0 && currentUser.serverAuthCode ? `${currentUser.serverAuthCode.substring(0, 20)}...` : 'Missing');
|
|
499
|
+
|
|
500
|
+
// Step 7: โ
Extract refresh capability
|
|
501
|
+
const refreshToken = ((_userInfo$data3 = userInfo.data) === null || _userInfo$data3 === void 0 ? void 0 : _userInfo$data3.serverAuthCode) || (currentUser === null || currentUser === void 0 ? void 0 : currentUser.serverAuthCode);
|
|
502
|
+
if (refreshToken) {
|
|
503
|
+
var _userInfo$data0, _userInfo$data1, _userInfo$data10, _userInfo$data11, _userInfo$data12, _userInfo$data13;
|
|
504
|
+
console.log('โ
SUCCESS: Got refresh token after consent!');
|
|
505
|
+
console.log('๐ Refresh token type:', refreshToken.startsWith('4/') ? 'serverAuthCode' : 'refreshToken');
|
|
506
|
+
console.log('๐ Refresh token preview:', `${refreshToken.substring(0, 20)}...`);
|
|
507
|
+
|
|
508
|
+
// Step 8: โ
Get YouTube channel info
|
|
509
|
+
let channelName = 'Unknown Channel';
|
|
510
|
+
let channelId = null;
|
|
511
|
+
try {
|
|
512
|
+
console.log('๐บ Fetching YouTube channel information...');
|
|
513
|
+
const channelResponse = await fetch('https://www.googleapis.com/youtube/v3/channels?part=snippet&mine=true', {
|
|
514
|
+
headers: {
|
|
515
|
+
'Authorization': `Bearer ${tokens.accessToken}`,
|
|
516
|
+
'Accept': 'application/json'
|
|
517
|
+
}
|
|
518
|
+
});
|
|
519
|
+
if (channelResponse.ok) {
|
|
520
|
+
const channelData = await channelResponse.json();
|
|
521
|
+
if (channelData.items && channelData.items.length > 0) {
|
|
522
|
+
channelName = channelData.items[0].snippet.title;
|
|
523
|
+
channelId = channelData.items[0].id;
|
|
524
|
+
console.log('โ
YouTube channel found:', channelName, 'ID:', channelId);
|
|
525
|
+
} else {
|
|
526
|
+
var _userInfo$data4, _userInfo$data5;
|
|
527
|
+
console.log('โ ๏ธ No YouTube channel found for user');
|
|
528
|
+
channelName = ((_userInfo$data4 = userInfo.data) === null || _userInfo$data4 === void 0 || (_userInfo$data4 = _userInfo$data4.user) === null || _userInfo$data4 === void 0 ? void 0 : _userInfo$data4.name) || ((_userInfo$data5 = userInfo.data) === null || _userInfo$data5 === void 0 || (_userInfo$data5 = _userInfo$data5.user) === null || _userInfo$data5 === void 0 ? void 0 : _userInfo$data5.email) || 'No Channel';
|
|
529
|
+
}
|
|
530
|
+
} else {
|
|
531
|
+
var _userInfo$data6, _userInfo$data7;
|
|
532
|
+
console.log('โ ๏ธ Failed to fetch YouTube channel info:', channelResponse.status);
|
|
533
|
+
channelName = ((_userInfo$data6 = userInfo.data) === null || _userInfo$data6 === void 0 || (_userInfo$data6 = _userInfo$data6.user) === null || _userInfo$data6 === void 0 ? void 0 : _userInfo$data6.name) || ((_userInfo$data7 = userInfo.data) === null || _userInfo$data7 === void 0 || (_userInfo$data7 = _userInfo$data7.user) === null || _userInfo$data7 === void 0 ? void 0 : _userInfo$data7.email) || 'Unknown Channel';
|
|
534
|
+
}
|
|
535
|
+
} catch (channelError) {
|
|
536
|
+
var _userInfo$data8, _userInfo$data9;
|
|
537
|
+
console.log('โ ๏ธ Error fetching YouTube channel info:', channelError);
|
|
538
|
+
channelName = ((_userInfo$data8 = userInfo.data) === null || _userInfo$data8 === void 0 || (_userInfo$data8 = _userInfo$data8.user) === null || _userInfo$data8 === void 0 ? void 0 : _userInfo$data8.name) || ((_userInfo$data9 = userInfo.data) === null || _userInfo$data9 === void 0 || (_userInfo$data9 = _userInfo$data9.user) === null || _userInfo$data9 === void 0 ? void 0 : _userInfo$data9.email) || 'Unknown Channel';
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
// Step 9: โ
Get authentication token using simplified JWT storage
|
|
542
|
+
let authToken = await getJWT();
|
|
543
|
+
if (!authToken || authToken.trim().length < 20) {
|
|
544
|
+
console.log('๐ Creating authentication token for YouTube connection...');
|
|
545
|
+
// Create token logic here if needed
|
|
546
|
+
authToken = 'temp_token_for_youtube_connection';
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
// Step 10: โ
Send comprehensive data to backend
|
|
550
|
+
const backendPayload = {
|
|
551
|
+
session: {
|
|
552
|
+
username: username,
|
|
553
|
+
platform: 'youtube',
|
|
554
|
+
timestamp: new Date().toISOString(),
|
|
555
|
+
channelName: channelName,
|
|
556
|
+
channelId: channelId,
|
|
557
|
+
forceConsent: true // Flag to indicate this was forced consent
|
|
558
|
+
},
|
|
559
|
+
googleUser: (_userInfo$data0 = userInfo.data) === null || _userInfo$data0 === void 0 ? void 0 : _userInfo$data0.user,
|
|
560
|
+
accessToken: tokens.accessToken,
|
|
561
|
+
idToken: tokens.idToken,
|
|
562
|
+
refreshToken: refreshToken,
|
|
563
|
+
// โ
CRITICAL: The refresh token!
|
|
564
|
+
serverAuthCode: refreshToken,
|
|
565
|
+
// โ
Same as refresh token
|
|
566
|
+
|
|
567
|
+
// โ
CRITICAL: Additional compatibility fields for backend
|
|
568
|
+
refresh_token: refreshToken,
|
|
569
|
+
// Snake case version
|
|
570
|
+
server_auth_code: refreshToken,
|
|
571
|
+
// Snake case version
|
|
572
|
+
authCode: refreshToken,
|
|
573
|
+
// Alternative naming
|
|
574
|
+
|
|
575
|
+
userAccountInfo: {
|
|
576
|
+
username: username,
|
|
577
|
+
email: (_userInfo$data1 = userInfo.data) === null || _userInfo$data1 === void 0 || (_userInfo$data1 = _userInfo$data1.user) === null || _userInfo$data1 === void 0 ? void 0 : _userInfo$data1.email,
|
|
578
|
+
authToken: authToken,
|
|
579
|
+
channelName: channelName,
|
|
580
|
+
channelId: channelId,
|
|
581
|
+
userIdentifier: authToken ? `user-${authToken.substring(0, 10)}` : `youtube-${(_userInfo$data10 = userInfo.data) === null || _userInfo$data10 === void 0 || (_userInfo$data10 = _userInfo$data10.user) === null || _userInfo$data10 === void 0 ? void 0 : _userInfo$data10.email}`,
|
|
582
|
+
googleId: (_userInfo$data11 = userInfo.data) === null || _userInfo$data11 === void 0 || (_userInfo$data11 = _userInfo$data11.user) === null || _userInfo$data11 === void 0 ? void 0 : _userInfo$data11.id,
|
|
583
|
+
// โ
CRITICAL: Also include refresh token in userAccountInfo
|
|
584
|
+
refreshToken: refreshToken,
|
|
585
|
+
serverAuthCode: refreshToken
|
|
586
|
+
},
|
|
587
|
+
tokenExpiry: new Date(Date.now() + 3600 * 1000).toISOString(),
|
|
588
|
+
// 1 hour from now
|
|
589
|
+
requestRefreshToken: true,
|
|
590
|
+
debugInfo: {
|
|
591
|
+
hasRefreshToken: true,
|
|
592
|
+
refreshTokenType: refreshToken.startsWith('4/') ? 'serverAuthCode' : 'refreshToken',
|
|
593
|
+
configuredForRefresh: true,
|
|
594
|
+
forcedConsent: true,
|
|
595
|
+
consentMethod: 'signOut_and_configure',
|
|
596
|
+
refreshTokenValue: refreshToken // Include actual value for debugging
|
|
597
|
+
}
|
|
598
|
+
};
|
|
599
|
+
console.log('๐ค Sending comprehensive payload with REFRESH TOKEN to backend:', {
|
|
600
|
+
hasAccessToken: !!backendPayload.accessToken,
|
|
601
|
+
hasRefreshToken: !!backendPayload.refreshToken,
|
|
602
|
+
hasServerAuthCode: !!backendPayload.serverAuthCode,
|
|
603
|
+
refreshTokenType: backendPayload.debugInfo.refreshTokenType,
|
|
604
|
+
userEmail: (_userInfo$data12 = userInfo.data) === null || _userInfo$data12 === void 0 || (_userInfo$data12 = _userInfo$data12.user) === null || _userInfo$data12 === void 0 ? void 0 : _userInfo$data12.email,
|
|
605
|
+
forcedConsent: true
|
|
606
|
+
});
|
|
607
|
+
|
|
608
|
+
// Step 11: โ
Send to backend with ENHANCED LOGGING
|
|
609
|
+
console.log('๐ [YOUTUBE REAUTH] ===== SENDING REAUTH SIGNAL TO BACKEND =====');
|
|
610
|
+
console.log('๐ [YOUTUBE REAUTH] Endpoint: https://API server/youtube/native-auth');
|
|
611
|
+
console.log('๐ [YOUTUBE REAUTH] Method: POST');
|
|
612
|
+
console.log('๐ [YOUTUBE REAUTH] Headers:', {
|
|
613
|
+
'Content-Type': 'application/json',
|
|
614
|
+
'Authorization': authToken ? `${authToken.substring(0, 20)}...` : 'NO AUTH TOKEN'
|
|
615
|
+
});
|
|
616
|
+
console.log('๐ [YOUTUBE REAUTH] Payload Summary:', {
|
|
617
|
+
hasAccessToken: !!backendPayload.accessToken,
|
|
618
|
+
hasRefreshToken: !!backendPayload.refreshToken,
|
|
619
|
+
hasServerAuthCode: !!backendPayload.serverAuthCode,
|
|
620
|
+
refreshTokenType: backendPayload.debugInfo.refreshTokenType,
|
|
621
|
+
userEmail: (_userInfo$data13 = userInfo.data) === null || _userInfo$data13 === void 0 || (_userInfo$data13 = _userInfo$data13.user) === null || _userInfo$data13 === void 0 ? void 0 : _userInfo$data13.email,
|
|
622
|
+
channelName: channelName,
|
|
623
|
+
forcedConsent: true,
|
|
624
|
+
requestRefreshToken: true
|
|
625
|
+
});
|
|
626
|
+
console.log('๐ [YOUTUBE REAUTH] FULL PAYLOAD:', JSON.stringify(backendPayload, null, 2));
|
|
627
|
+
const backendResponse = await fetch(`${API_CONFIG.BASE_URL}/youtube/native-auth`, {
|
|
628
|
+
method: 'POST',
|
|
629
|
+
headers: {
|
|
630
|
+
'Content-Type': 'application/json',
|
|
631
|
+
...(authToken && {
|
|
632
|
+
'Authorization': authToken
|
|
633
|
+
})
|
|
634
|
+
},
|
|
635
|
+
body: JSON.stringify(backendPayload)
|
|
636
|
+
});
|
|
637
|
+
console.log('๐ก [YOUTUBE REAUTH] Response Status:', backendResponse.status);
|
|
638
|
+
console.log('๐ก [YOUTUBE REAUTH] Response Status Text:', backendResponse.statusText);
|
|
639
|
+
console.log('๐ก [YOUTUBE REAUTH] Response Headers:', backendResponse.headers);
|
|
640
|
+
if (backendResponse.ok) {
|
|
641
|
+
var _responseData$validat, _responseData$tempora;
|
|
642
|
+
const responseData = await backendResponse.json();
|
|
643
|
+
console.log('โ
[YOUTUBE REAUTH] Backend Response SUCCESS:', JSON.stringify(responseData, null, 2));
|
|
644
|
+
|
|
645
|
+
// Enhanced verification with detailed logging and temporary mode detection (exact backend fields)
|
|
646
|
+
const isTemporaryMode = ((_responseData$validat = responseData.validation) === null || _responseData$validat === void 0 ? void 0 : _responseData$validat.isTemporaryMode) === true || ((_responseData$tempora = responseData.temporaryMode) === null || _responseData$tempora === void 0 ? void 0 : _responseData$tempora.enabled) === true || responseData.isTemporaryMode === true || responseData.message && responseData.message.includes('temporary access token mode');
|
|
647
|
+
if (isTemporaryMode) {
|
|
648
|
+
console.log('๐ [YOUTUBE REAUTH] YouTube connected in temporary mode');
|
|
649
|
+
console.log('โ
[YOUTUBE REAUTH] Training will work, but connection expires in ~1 hour');
|
|
650
|
+
console.log('๐ [YOUTUBE REAUTH] SUCCESS: Temporary YouTube connection established!');
|
|
651
|
+
console.log('๐ [YOUTUBE REAUTH] Connection Details:');
|
|
652
|
+
console.log('๐ [YOUTUBE REAUTH] Mode: Temporary (expires ~1 hour)');
|
|
653
|
+
console.log('๐ [YOUTUBE REAUTH] Training Ready: Yes');
|
|
654
|
+
console.log('๐ [YOUTUBE REAUTH] Refresh token sent:', refreshToken ? 'Yes' : 'No');
|
|
655
|
+
} else if (responseData.hasRefreshToken || responseData.refreshTokenReceived) {
|
|
656
|
+
console.log('โ
[YOUTUBE REAUTH] Backend CONFIRMED refresh token received');
|
|
657
|
+
console.log('โ
[YOUTUBE REAUTH] Response hasRefreshToken:', responseData.hasRefreshToken);
|
|
658
|
+
console.log('๐ [YOUTUBE REAUTH] SUCCESS: Full YouTube connection with refresh tokens!');
|
|
659
|
+
|
|
660
|
+
// CRITICAL: Print the refresh token that was sent for debugging
|
|
661
|
+
console.log('๐ [YOUTUBE REAUTH] REFRESH TOKEN SENT TO BACKEND:');
|
|
662
|
+
console.log('๐ [YOUTUBE REAUTH] Full refresh token:', refreshToken);
|
|
663
|
+
console.log('๐ [YOUTUBE REAUTH] Refresh token type:', refreshToken.startsWith('4/') ? 'serverAuthCode' : 'refreshToken');
|
|
664
|
+
console.log('๐ [YOUTUBE REAUTH] Refresh token length:', refreshToken.length);
|
|
665
|
+
} else {
|
|
666
|
+
console.warn('โ ๏ธ [YOUTUBE REAUTH] Backend did NOT confirm refresh token reception');
|
|
667
|
+
console.warn('โ ๏ธ [YOUTUBE REAUTH] Response data:', responseData);
|
|
668
|
+
console.warn('โ ๏ธ [YOUTUBE REAUTH] Expected hasRefreshToken or refreshTokenReceived in response');
|
|
669
|
+
return false;
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
// CRITICAL: Signal training system to restart with new connection
|
|
673
|
+
console.log('๐ [YOUTUBE REAUTH] Signaling training system to restart...');
|
|
674
|
+
try {
|
|
675
|
+
await triggerTrainingRestart(username, authToken);
|
|
676
|
+
console.log('โ
[YOUTUBE REAUTH] Training restart signal sent successfully');
|
|
677
|
+
} catch (restartError) {
|
|
678
|
+
console.warn('โ ๏ธ [YOUTUBE REAUTH] Training restart signal failed:', restartError);
|
|
679
|
+
console.warn('โ ๏ธ [YOUTUBE REAUTH] User may need to manually restart training');
|
|
680
|
+
}
|
|
681
|
+
return true;
|
|
682
|
+
} else {
|
|
683
|
+
const errorData = await backendResponse.text();
|
|
684
|
+
console.error('โ [YOUTUBE REAUTH] Backend processing FAILED:', backendResponse.status, errorData);
|
|
685
|
+
console.error('โ [YOUTUBE REAUTH] This means the reauth signal was not processed');
|
|
686
|
+
return false;
|
|
687
|
+
}
|
|
688
|
+
} else {
|
|
689
|
+
console.error('โ CRITICAL: No refresh token even after consent screen');
|
|
690
|
+
console.error('โ This means consent screen did not appear or user denied permissions');
|
|
691
|
+
console.error('๐ก Solutions:');
|
|
692
|
+
console.error(' 1. Try the revoke method: forceYouTubeReconnectionWithRevoke()');
|
|
693
|
+
console.error(' 2. Check Google Console OAuth configuration');
|
|
694
|
+
console.error(' 3. Ensure user clicks "Allow" on consent screen');
|
|
695
|
+
return false;
|
|
696
|
+
}
|
|
697
|
+
} catch (error) {
|
|
698
|
+
console.error('โ Error forcing YouTube consent:', error);
|
|
699
|
+
if (error.code === statusCodes.SIGN_IN_CANCELLED) {
|
|
700
|
+
console.error('โ User cancelled sign-in - no refresh token obtained');
|
|
701
|
+
console.error('๐ก User must click "Allow" to get refresh token');
|
|
702
|
+
} else if (error.code === statusCodes.IN_PROGRESS) {
|
|
703
|
+
console.error('โ Sign-in already in progress');
|
|
704
|
+
} else if (error.code === statusCodes.PLAY_SERVICES_NOT_AVAILABLE) {
|
|
705
|
+
console.error('โ Google Play Services not available');
|
|
706
|
+
}
|
|
707
|
+
return false;
|
|
708
|
+
}
|
|
709
|
+
};
|
|
710
|
+
|
|
711
|
+
/**
|
|
712
|
+
* Alternative method: Force consent by revoking existing permissions
|
|
713
|
+
*/
|
|
714
|
+
export const forceYouTubeReconnectionWithRevoke = async username => {
|
|
715
|
+
try {
|
|
716
|
+
var _userInfo$data14;
|
|
717
|
+
console.log('๐ FORCING YouTube consent via REVOKE method...');
|
|
718
|
+
console.log('๐ค User:', username);
|
|
719
|
+
|
|
720
|
+
// Step 1: Initialize Google Sign-In
|
|
721
|
+
initializeGoogleSignIn();
|
|
722
|
+
await GoogleSignin.hasPlayServices();
|
|
723
|
+
|
|
724
|
+
// Step 2: โ
CRITICAL: Revoke existing permissions (forces fresh consent)
|
|
725
|
+
try {
|
|
726
|
+
await GoogleSignin.revokeAccess();
|
|
727
|
+
console.log('โ
Revoked existing permissions - fresh consent REQUIRED');
|
|
728
|
+
} catch (revokeError) {
|
|
729
|
+
console.log('โน๏ธ No existing permissions to revoke:', revokeError);
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
// Step 3: Sign out completely
|
|
733
|
+
await GoogleSignin.signOut();
|
|
734
|
+
console.log('โ
Signed out completely');
|
|
735
|
+
|
|
736
|
+
// Step 4: โ
Now sign in again (will DEFINITELY show consent screen)
|
|
737
|
+
console.log('๐ Signing in after revoke - consent screen MUST appear...');
|
|
738
|
+
const userInfo = await GoogleSignin.signIn();
|
|
739
|
+
|
|
740
|
+
// Step 5: โ
User will definitely see consent screen now
|
|
741
|
+
const tokens = await GoogleSignin.getTokens();
|
|
742
|
+
const currentUser = await GoogleSignin.getCurrentUser();
|
|
743
|
+
const refreshToken = ((_userInfo$data14 = userInfo.data) === null || _userInfo$data14 === void 0 ? void 0 : _userInfo$data14.serverAuthCode) || (currentUser === null || currentUser === void 0 ? void 0 : currentUser.serverAuthCode);
|
|
744
|
+
if (refreshToken) {
|
|
745
|
+
console.log('โ
SUCCESS: Got refresh token after REVOKE + consent!');
|
|
746
|
+
console.log('๐ Refresh token preview:', `${refreshToken.substring(0, 20)}...`);
|
|
747
|
+
|
|
748
|
+
// Continue with the same backend submission logic as above
|
|
749
|
+
// (Similar to forceYouTubeReconnectionWithConsent)
|
|
750
|
+
|
|
751
|
+
return true;
|
|
752
|
+
} else {
|
|
753
|
+
console.error('โ Still no refresh token after revoke method');
|
|
754
|
+
return false;
|
|
755
|
+
}
|
|
756
|
+
} catch (error) {
|
|
757
|
+
console.error('โ Error with revoke method:', error);
|
|
758
|
+
return false;
|
|
759
|
+
}
|
|
760
|
+
};
|
|
761
|
+
|
|
762
|
+
/**
|
|
763
|
+
* Fix YouTube connection for a specific user (like nicholase50)
|
|
764
|
+
*/
|
|
765
|
+
export const fixUserYouTubeConnection = async username => {
|
|
766
|
+
console.log(`๐ง Fixing YouTube connection for user: ${username}`);
|
|
767
|
+
|
|
768
|
+
// Method 1: Try forced consent via configuration
|
|
769
|
+
console.log('๐ Method 1: Trying forced consent via configuration...');
|
|
770
|
+
let success = await forceYouTubeReconnectionWithConsent(username);
|
|
771
|
+
if (success) {
|
|
772
|
+
console.log(`โ
${username} YouTube connection fixed via Method 1!`);
|
|
773
|
+
return true;
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
// Method 2: Try forced consent via revoke
|
|
777
|
+
console.log('๐ Method 2: Trying forced consent via revoke...');
|
|
778
|
+
success = await forceYouTubeReconnectionWithRevoke(username);
|
|
779
|
+
if (success) {
|
|
780
|
+
console.log(`โ
${username} YouTube connection fixed via Method 2!`);
|
|
781
|
+
return true;
|
|
782
|
+
}
|
|
783
|
+
console.error(`โ Failed to fix ${username} YouTube connection with both methods`);
|
|
784
|
+
return false;
|
|
785
|
+
};
|
|
786
|
+
|
|
787
|
+
/**
|
|
788
|
+
* Get fresh tokens using refresh token
|
|
789
|
+
*/
|
|
790
|
+
const refreshGoogleTokens = async () => {
|
|
791
|
+
try {
|
|
792
|
+
console.log('๐ Attempting to refresh Google tokens...');
|
|
793
|
+
|
|
794
|
+
// Check if user is signed in
|
|
795
|
+
const currentUser = await GoogleSignin.getCurrentUser();
|
|
796
|
+
if (!currentUser) {
|
|
797
|
+
console.log('โ User not signed in to Google, cannot refresh tokens');
|
|
798
|
+
return null;
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
// Get fresh tokens
|
|
802
|
+
const tokens = await GoogleSignin.getTokens();
|
|
803
|
+
console.log('โ
Successfully refreshed Google tokens');
|
|
804
|
+
return {
|
|
805
|
+
accessToken: tokens.accessToken,
|
|
806
|
+
idToken: tokens.idToken
|
|
807
|
+
};
|
|
808
|
+
} catch (error) {
|
|
809
|
+
console.error('โ Failed to refresh Google tokens:', error);
|
|
810
|
+
|
|
811
|
+
// If refresh fails, try to sign in again
|
|
812
|
+
try {
|
|
813
|
+
console.log('๐ Refresh failed, attempting re-authentication...');
|
|
814
|
+
const userInfo = await GoogleSignin.signIn();
|
|
815
|
+
const tokens = await GoogleSignin.getTokens();
|
|
816
|
+
console.log('โ
Re-authentication successful');
|
|
817
|
+
return {
|
|
818
|
+
accessToken: tokens.accessToken,
|
|
819
|
+
idToken: tokens.idToken
|
|
820
|
+
};
|
|
821
|
+
} catch (signInError) {
|
|
822
|
+
console.error('โ Re-authentication also failed:', signInError);
|
|
823
|
+
return null;
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
};
|
|
827
|
+
|
|
828
|
+
/**
|
|
829
|
+
* Debug YouTube tokens to verify refresh token availability
|
|
830
|
+
*/
|
|
831
|
+
const debugYouTubeTokens = async () => {
|
|
832
|
+
try {
|
|
833
|
+
var _currentUser$user;
|
|
834
|
+
const tokens = await GoogleSignin.getTokens();
|
|
835
|
+
const currentUser = await GoogleSignin.getCurrentUser();
|
|
836
|
+
console.log('๐ YouTube Token Debug:', {
|
|
837
|
+
accessToken: tokens.accessToken ? `${tokens.accessToken.substring(0, 20)}...` : 'Missing',
|
|
838
|
+
idToken: tokens.idToken ? 'Present' : 'Missing',
|
|
839
|
+
serverAuthCode: currentUser !== null && currentUser !== void 0 && currentUser.serverAuthCode ? `${currentUser.serverAuthCode.substring(0, 20)}...` : 'Missing',
|
|
840
|
+
userEmail: (currentUser === null || currentUser === void 0 || (_currentUser$user = currentUser.user) === null || _currentUser$user === void 0 ? void 0 : _currentUser$user.email) || 'Missing'
|
|
841
|
+
});
|
|
842
|
+
return {
|
|
843
|
+
hasRefreshToken: !!(currentUser !== null && currentUser !== void 0 && currentUser.serverAuthCode),
|
|
844
|
+
refreshTokenType: currentUser !== null && currentUser !== void 0 && currentUser.serverAuthCode ? 'serverAuthCode' : 'none'
|
|
845
|
+
};
|
|
846
|
+
} catch (error) {
|
|
847
|
+
console.error('โ Debug tokens failed:', error);
|
|
848
|
+
return {
|
|
849
|
+
hasRefreshToken: false,
|
|
850
|
+
refreshTokenType: 'error'
|
|
851
|
+
};
|
|
852
|
+
}
|
|
853
|
+
};
|
|
854
|
+
|
|
855
|
+
/**
|
|
856
|
+
* Force fresh YouTube reconnection with proper refresh token
|
|
857
|
+
*/
|
|
858
|
+
export const reconnectYouTube = async username => {
|
|
859
|
+
try {
|
|
860
|
+
console.log('๐ Forcing fresh YouTube reconnection for refresh token...');
|
|
861
|
+
|
|
862
|
+
// 1. Sign out completely to force fresh consent
|
|
863
|
+
try {
|
|
864
|
+
await GoogleSignin.signOut();
|
|
865
|
+
console.log('โ
Signed out from Google');
|
|
866
|
+
} catch (signOutError) {
|
|
867
|
+
console.log('โน๏ธ Already signed out or sign out failed:', signOutError);
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
// 2. Clear any cached tokens
|
|
871
|
+
try {
|
|
872
|
+
const currentTokens = await GoogleSignin.getTokens();
|
|
873
|
+
if (currentTokens.accessToken) {
|
|
874
|
+
await GoogleSignin.clearCachedAccessToken(currentTokens.accessToken);
|
|
875
|
+
console.log('โ
Cleared cached access token');
|
|
876
|
+
}
|
|
877
|
+
} catch (clearError) {
|
|
878
|
+
console.log('โน๏ธ Token clearing failed or not needed:', clearError);
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
// 3. Re-authenticate with fresh consent
|
|
882
|
+
const result = await initiateNativeAuth('youtube', username);
|
|
883
|
+
if (result) {
|
|
884
|
+
console.log('โ
YouTube reconnected successfully with refresh token');
|
|
885
|
+
|
|
886
|
+
// 4. Verify we now have a refresh token
|
|
887
|
+
const debugInfo = await debugYouTubeTokens();
|
|
888
|
+
if (debugInfo.hasRefreshToken) {
|
|
889
|
+
console.log('โ
Refresh token confirmed:', debugInfo.refreshTokenType);
|
|
890
|
+
} else {
|
|
891
|
+
console.warn('โ ๏ธ Still no refresh token after reconnection');
|
|
892
|
+
}
|
|
893
|
+
return true;
|
|
894
|
+
} else {
|
|
895
|
+
console.error('โ YouTube reconnection failed');
|
|
896
|
+
return false;
|
|
897
|
+
}
|
|
898
|
+
} catch (error) {
|
|
899
|
+
console.error('โ YouTube reconnection error:', error);
|
|
900
|
+
return false;
|
|
901
|
+
}
|
|
902
|
+
};
|
|
903
|
+
|
|
904
|
+
/**
|
|
905
|
+
* Initiate native authentication for platforms with SDKs
|
|
906
|
+
*/
|
|
907
|
+
export const initiateNativeAuth = async (platform, username) => {
|
|
908
|
+
if (platform === 'youtube') {
|
|
909
|
+
console.log('๐ Initiating native Google Sign-In for YouTube');
|
|
910
|
+
|
|
911
|
+
// Validate username for YouTube
|
|
912
|
+
if (!username || username.trim() === '') {
|
|
913
|
+
console.error('โ [YOUTUBE AUTH] Username is required for YouTube authentication');
|
|
914
|
+
return false;
|
|
915
|
+
}
|
|
916
|
+
try {
|
|
917
|
+
var _userInfo$data15, _currentUser$user2, _userInfo$data16, _userInfo$data17, _userInfo$data24, _userInfo$data25, _userInfo$data26, _userInfo$data27, _userInfo$data28, _userInfo$data29;
|
|
918
|
+
// Initialize Google Sign-In if not already done
|
|
919
|
+
// โ
CRITICAL: Initialize with CORRECT iOS Client ID
|
|
920
|
+
initializeGoogleSignIn();
|
|
921
|
+
|
|
922
|
+
// Check if Google Play Services are available
|
|
923
|
+
await GoogleSignin.hasPlayServices();
|
|
924
|
+
|
|
925
|
+
// โ
CRITICAL: Force sign out first to ensure fresh consent
|
|
926
|
+
try {
|
|
927
|
+
await GoogleSignin.signOut();
|
|
928
|
+
console.log('๐ Signed out to force fresh consent');
|
|
929
|
+
} catch (signOutError) {
|
|
930
|
+
console.log('โน๏ธ Sign out not needed or failed:', signOutError);
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
// Sign in with Google (this will show consent screen due to our config)
|
|
934
|
+
const userInfo = await GoogleSignin.signIn();
|
|
935
|
+
console.log('โ
Google Sign-In successful:', (_userInfo$data15 = userInfo.data) === null || _userInfo$data15 === void 0 || (_userInfo$data15 = _userInfo$data15.user) === null || _userInfo$data15 === void 0 ? void 0 : _userInfo$data15.email);
|
|
936
|
+
console.log('๐ FULL userInfo object:');
|
|
937
|
+
console.log(JSON.stringify(userInfo, null, 2));
|
|
938
|
+
|
|
939
|
+
// Get access token for API calls
|
|
940
|
+
const tokens = await GoogleSignin.getTokens();
|
|
941
|
+
console.log('๐ Got Google tokens');
|
|
942
|
+
console.log('๐ FULL tokens object:');
|
|
943
|
+
console.log(JSON.stringify(tokens, null, 2));
|
|
944
|
+
|
|
945
|
+
// CRITICAL: Get the current user info which contains the refresh token
|
|
946
|
+
const currentUser = await GoogleSignin.getCurrentUser();
|
|
947
|
+
console.log('๐ค Current user info:', currentUser === null || currentUser === void 0 || (_currentUser$user2 = currentUser.user) === null || _currentUser$user2 === void 0 ? void 0 : _currentUser$user2.email);
|
|
948
|
+
console.log('๐ FULL currentUser object:');
|
|
949
|
+
console.log(JSON.stringify(currentUser, null, 2));
|
|
950
|
+
|
|
951
|
+
// โ
CRITICAL: Extract refresh token properly using serverAuthCode
|
|
952
|
+
let refreshToken = null;
|
|
953
|
+
console.log('๐ REFRESH TOKEN EXTRACTION:');
|
|
954
|
+
console.log('- userInfo.data?.serverAuthCode:', (_userInfo$data16 = userInfo.data) !== null && _userInfo$data16 !== void 0 && _userInfo$data16.serverAuthCode ? `Present: ${userInfo.data.serverAuthCode.substring(0, 20)}...` : 'Missing');
|
|
955
|
+
console.log('- currentUser?.serverAuthCode:', currentUser !== null && currentUser !== void 0 && currentUser.serverAuthCode ? `Present: ${currentUser.serverAuthCode.substring(0, 20)}...` : 'Missing');
|
|
956
|
+
console.log('- tokens.idToken:', tokens.idToken ? `Present: ${tokens.idToken.substring(0, 20)}...` : 'Missing');
|
|
957
|
+
console.log('- tokens.accessToken:', tokens.accessToken ? `Present: ${tokens.accessToken.substring(0, 20)}...` : 'Missing');
|
|
958
|
+
|
|
959
|
+
// The serverAuthCode is the refresh token mechanism for React Native Google Sign-In
|
|
960
|
+
if (currentUser !== null && currentUser !== void 0 && currentUser.serverAuthCode) {
|
|
961
|
+
refreshToken = currentUser.serverAuthCode;
|
|
962
|
+
console.log('โ
Got serverAuthCode (refresh token mechanism)');
|
|
963
|
+
console.log('๐ Refresh token preview:', `${refreshToken.substring(0, 20)}...`);
|
|
964
|
+
} else if ((_userInfo$data17 = userInfo.data) !== null && _userInfo$data17 !== void 0 && _userInfo$data17.serverAuthCode) {
|
|
965
|
+
refreshToken = userInfo.data.serverAuthCode;
|
|
966
|
+
console.log('โ
Got serverAuthCode from sign-in response');
|
|
967
|
+
console.log('๐ Refresh token preview:', `${refreshToken.substring(0, 20)}...`);
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
// โ
CRITICAL: Verify refresh token availability
|
|
971
|
+
if (!refreshToken) {
|
|
972
|
+
console.error('โ CRITICAL: No refresh token available - YouTube connection will fail when token expires');
|
|
973
|
+
console.error('๐ก User needs to reconnect with proper consent screen');
|
|
974
|
+
console.error('๐ก Check Google Sign-In configuration: offlineAccess, forceCodeForRefreshToken');
|
|
975
|
+
|
|
976
|
+
// Still continue but warn about the issue
|
|
977
|
+
console.warn('โ ๏ธ Continuing without refresh token - connection may fail later');
|
|
978
|
+
} else {
|
|
979
|
+
console.log('โ
Refresh token available for YouTube connection');
|
|
980
|
+
console.log('๐ Refresh token type:', refreshToken.startsWith('4/') ? 'serverAuthCode' : 'refreshToken');
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
// Fetch YouTube channel information using the access token
|
|
984
|
+
let channelName = 'Unknown Channel';
|
|
985
|
+
let channelId = null;
|
|
986
|
+
try {
|
|
987
|
+
console.log('๐บ Fetching YouTube channel information...');
|
|
988
|
+
const channelResponse = await fetch('https://www.googleapis.com/youtube/v3/channels?part=snippet&mine=true', {
|
|
989
|
+
headers: {
|
|
990
|
+
'Authorization': `Bearer ${tokens.accessToken}`,
|
|
991
|
+
'Accept': 'application/json'
|
|
992
|
+
}
|
|
993
|
+
});
|
|
994
|
+
if (channelResponse.ok) {
|
|
995
|
+
const channelData = await channelResponse.json();
|
|
996
|
+
if (channelData.items && channelData.items.length > 0) {
|
|
997
|
+
channelName = channelData.items[0].snippet.title;
|
|
998
|
+
channelId = channelData.items[0].id;
|
|
999
|
+
console.log('โ
YouTube channel found:', channelName, 'ID:', channelId);
|
|
1000
|
+
} else {
|
|
1001
|
+
var _userInfo$data18, _userInfo$data19;
|
|
1002
|
+
console.log('โ ๏ธ No YouTube channel found for user');
|
|
1003
|
+
channelName = ((_userInfo$data18 = userInfo.data) === null || _userInfo$data18 === void 0 || (_userInfo$data18 = _userInfo$data18.user) === null || _userInfo$data18 === void 0 ? void 0 : _userInfo$data18.name) || ((_userInfo$data19 = userInfo.data) === null || _userInfo$data19 === void 0 || (_userInfo$data19 = _userInfo$data19.user) === null || _userInfo$data19 === void 0 ? void 0 : _userInfo$data19.email) || 'No Channel';
|
|
1004
|
+
}
|
|
1005
|
+
} else {
|
|
1006
|
+
var _userInfo$data20, _userInfo$data21;
|
|
1007
|
+
console.log('โ ๏ธ Failed to fetch YouTube channel info:', channelResponse.status);
|
|
1008
|
+
channelName = ((_userInfo$data20 = userInfo.data) === null || _userInfo$data20 === void 0 || (_userInfo$data20 = _userInfo$data20.user) === null || _userInfo$data20 === void 0 ? void 0 : _userInfo$data20.name) || ((_userInfo$data21 = userInfo.data) === null || _userInfo$data21 === void 0 || (_userInfo$data21 = _userInfo$data21.user) === null || _userInfo$data21 === void 0 ? void 0 : _userInfo$data21.email) || 'Unknown Channel';
|
|
1009
|
+
}
|
|
1010
|
+
} catch (channelError) {
|
|
1011
|
+
var _userInfo$data22, _userInfo$data23;
|
|
1012
|
+
console.log('โ ๏ธ Error fetching YouTube channel info:', channelError);
|
|
1013
|
+
channelName = ((_userInfo$data22 = userInfo.data) === null || _userInfo$data22 === void 0 || (_userInfo$data22 = _userInfo$data22.user) === null || _userInfo$data22 === void 0 ? void 0 : _userInfo$data22.name) || ((_userInfo$data23 = userInfo.data) === null || _userInfo$data23 === void 0 || (_userInfo$data23 = _userInfo$data23.user) === null || _userInfo$data23 === void 0 ? void 0 : _userInfo$data23.email) || 'Unknown Channel';
|
|
1014
|
+
}
|
|
1015
|
+
|
|
1016
|
+
// Get stored authentication info to link YouTube data to user account
|
|
1017
|
+
// NOTE: SDK no longer creates EnochUser - consuming app should handle this
|
|
1018
|
+
let authToken = await getJWT();
|
|
1019
|
+
const storedUsername = await AsyncStorage.getItem('onairos_username');
|
|
1020
|
+
const finalUsername = storedUsername || username || ((_userInfo$data24 = userInfo.data) === null || _userInfo$data24 === void 0 || (_userInfo$data24 = _userInfo$data24.user) === null || _userInfo$data24 === void 0 ? void 0 : _userInfo$data24.email) || 'youtube_user';
|
|
1021
|
+
|
|
1022
|
+
// Log authentication status - SDK does NOT create users during YouTube connection
|
|
1023
|
+
if (!authToken || authToken.trim().length < 20) {
|
|
1024
|
+
console.log('โน๏ธ No valid authentication token found for YouTube connection');
|
|
1025
|
+
console.log('โน๏ธ NOTE: SDK does not create users during YouTube connection');
|
|
1026
|
+
console.log('โน๏ธ User should authenticate first via Google/Apple/Email before connecting YouTube');
|
|
1027
|
+
// Continue without token - YouTube connection will work but may not be linked to user
|
|
1028
|
+
} else {
|
|
1029
|
+
console.log('โ
Found existing authentication token for YouTube auth');
|
|
1030
|
+
console.log('๐ Token preview:', `${authToken.substring(0, 20)}...`);
|
|
1031
|
+
}
|
|
1032
|
+
console.log('๐ Linking YouTube data to user:', finalUsername);
|
|
1033
|
+
console.log('๐ Using auth token for linking:', authToken ? `${authToken.substring(0, 20)}...` : 'No token');
|
|
1034
|
+
console.log('๐บ YouTube channel name:', channelName);
|
|
1035
|
+
|
|
1036
|
+
// โ
CRITICAL: Enhanced payload with comprehensive refresh token data
|
|
1037
|
+
const backendPayload = {
|
|
1038
|
+
session: {
|
|
1039
|
+
username: finalUsername,
|
|
1040
|
+
platform: 'youtube',
|
|
1041
|
+
timestamp: new Date().toISOString(),
|
|
1042
|
+
channelName: channelName,
|
|
1043
|
+
channelId: channelId
|
|
1044
|
+
},
|
|
1045
|
+
googleUser: (_userInfo$data25 = userInfo.data) === null || _userInfo$data25 === void 0 ? void 0 : _userInfo$data25.user,
|
|
1046
|
+
accessToken: tokens.accessToken,
|
|
1047
|
+
idToken: tokens.idToken,
|
|
1048
|
+
refreshToken: refreshToken,
|
|
1049
|
+
// โ
CRITICAL: Include refresh token
|
|
1050
|
+
serverAuthCode: refreshToken,
|
|
1051
|
+
// โ
Alternative refresh mechanism (same as refreshToken)
|
|
1052
|
+
|
|
1053
|
+
// โ
CRITICAL: Additional compatibility fields for backend
|
|
1054
|
+
refresh_token: refreshToken,
|
|
1055
|
+
// Snake case version
|
|
1056
|
+
server_auth_code: refreshToken,
|
|
1057
|
+
// Snake case version
|
|
1058
|
+
authCode: refreshToken,
|
|
1059
|
+
// Alternative naming
|
|
1060
|
+
|
|
1061
|
+
// Include user account linking information
|
|
1062
|
+
userAccountInfo: {
|
|
1063
|
+
username: finalUsername,
|
|
1064
|
+
email: (_userInfo$data26 = userInfo.data) === null || _userInfo$data26 === void 0 || (_userInfo$data26 = _userInfo$data26.user) === null || _userInfo$data26 === void 0 ? void 0 : _userInfo$data26.email,
|
|
1065
|
+
authToken: authToken,
|
|
1066
|
+
channelName: channelName,
|
|
1067
|
+
channelId: channelId,
|
|
1068
|
+
// CRITICAL: Include user identifier that matches your database
|
|
1069
|
+
userIdentifier: authToken ? `user-${authToken.substring(0, 10)}` : `youtube-${(_userInfo$data27 = userInfo.data) === null || _userInfo$data27 === void 0 || (_userInfo$data27 = _userInfo$data27.user) === null || _userInfo$data27 === void 0 ? void 0 : _userInfo$data27.email}`,
|
|
1070
|
+
googleId: (_userInfo$data28 = userInfo.data) === null || _userInfo$data28 === void 0 || (_userInfo$data28 = _userInfo$data28.user) === null || _userInfo$data28 === void 0 ? void 0 : _userInfo$data28.id,
|
|
1071
|
+
appleUserId: authToken !== null && authToken !== void 0 && authToken.includes('apple') ? authToken.split('.')[1] : null,
|
|
1072
|
+
// โ
CRITICAL: Also include refresh token in userAccountInfo
|
|
1073
|
+
refreshToken: refreshToken,
|
|
1074
|
+
serverAuthCode: refreshToken
|
|
1075
|
+
},
|
|
1076
|
+
// Token expiry information
|
|
1077
|
+
tokenExpiry: new Date(Date.now() + 3600 * 1000).toISOString(),
|
|
1078
|
+
// 1 hour from now
|
|
1079
|
+
// Force refresh token request
|
|
1080
|
+
requestRefreshToken: true,
|
|
1081
|
+
// โ
CRITICAL: Debug information for backend
|
|
1082
|
+
debugInfo: {
|
|
1083
|
+
hasRefreshToken: !!refreshToken,
|
|
1084
|
+
refreshTokenType: refreshToken ? refreshToken.startsWith('4/') ? 'serverAuthCode' : 'refreshToken' : 'none',
|
|
1085
|
+
configuredForRefresh: true,
|
|
1086
|
+
forcedConsent: true,
|
|
1087
|
+
refreshTokenValue: refreshToken // Include actual value for debugging
|
|
1088
|
+
}
|
|
1089
|
+
};
|
|
1090
|
+
console.log('๐ค BACKEND PAYLOAD SUMMARY:');
|
|
1091
|
+
console.log('- hasAccessToken:', !!backendPayload.accessToken);
|
|
1092
|
+
console.log('- hasRefreshToken:', !!backendPayload.refreshToken);
|
|
1093
|
+
console.log('- hasServerAuthCode:', !!backendPayload.serverAuthCode);
|
|
1094
|
+
console.log('- refreshTokenType:', backendPayload.debugInfo.refreshTokenType);
|
|
1095
|
+
console.log('- userEmail:', (_userInfo$data29 = userInfo.data) === null || _userInfo$data29 === void 0 || (_userInfo$data29 = _userInfo$data29.user) === null || _userInfo$data29 === void 0 ? void 0 : _userInfo$data29.email);
|
|
1096
|
+
console.log('- channelName:', channelName);
|
|
1097
|
+
console.log('๐ COMPLETE BACKEND PAYLOAD:');
|
|
1098
|
+
console.log(JSON.stringify(backendPayload, null, 2));
|
|
1099
|
+
|
|
1100
|
+
// Send the tokens to your backend for YouTube data processing with ENHANCED LOGGING
|
|
1101
|
+
console.log('๐ค Sending YouTube auth to backend with refresh token:', !!refreshToken);
|
|
1102
|
+
const backendResponse = await fetch(`${API_CONFIG.BASE_URL}/youtube/native-auth`, {
|
|
1103
|
+
method: 'POST',
|
|
1104
|
+
headers: {
|
|
1105
|
+
'Content-Type': 'application/json',
|
|
1106
|
+
...(authToken && {
|
|
1107
|
+
'Authorization': authToken
|
|
1108
|
+
}) // Include auth token if available
|
|
1109
|
+
},
|
|
1110
|
+
body: JSON.stringify(backendPayload)
|
|
1111
|
+
});
|
|
1112
|
+
console.log('๐ก Backend response status:', backendResponse.status);
|
|
1113
|
+
console.log('๐ก Backend response headers:', backendResponse.headers);
|
|
1114
|
+
if (backendResponse.ok) {
|
|
1115
|
+
var _responseData$validat2, _responseData$tempora2;
|
|
1116
|
+
const responseData = await backendResponse.json();
|
|
1117
|
+
console.log('โ
YouTube connection successful');
|
|
1118
|
+
console.log('๐ COMPLETE BACKEND RESPONSE:');
|
|
1119
|
+
console.log(JSON.stringify(responseData, null, 2));
|
|
1120
|
+
|
|
1121
|
+
// โ
Enhanced verification with temporary mode detection (exact backend fields)
|
|
1122
|
+
const isTemporaryMode = ((_responseData$validat2 = responseData.validation) === null || _responseData$validat2 === void 0 ? void 0 : _responseData$validat2.isTemporaryMode) === true || ((_responseData$tempora2 = responseData.temporaryMode) === null || _responseData$tempora2 === void 0 ? void 0 : _responseData$tempora2.enabled) === true || responseData.isTemporaryMode === true || responseData.message && responseData.message.includes('temporary access token mode');
|
|
1123
|
+
if (isTemporaryMode) {
|
|
1124
|
+
console.log('๐ [YOUTUBE AUTH] YouTube connected in temporary mode');
|
|
1125
|
+
console.log('โ
[YOUTUBE AUTH] Training will work, but connection expires in ~1 hour');
|
|
1126
|
+
console.log('โน๏ธ [YOUTUBE AUTH] User can reconnect later for refresh tokens if needed');
|
|
1127
|
+
} else if (responseData.hasRefreshToken || responseData.refreshTokenReceived) {
|
|
1128
|
+
console.log('โ
[YOUTUBE AUTH] Backend confirmed refresh token received');
|
|
1129
|
+
console.log('โ
[YOUTUBE AUTH] Full YouTube connection with persistent access');
|
|
1130
|
+
} else {
|
|
1131
|
+
console.warn('โ ๏ธ [YOUTUBE AUTH] Backend did not confirm refresh token');
|
|
1132
|
+
console.warn('๐ [YOUTUBE AUTH] Response data keys:', Object.keys(responseData));
|
|
1133
|
+
console.warn('โ ๏ธ [YOUTUBE AUTH] Connection may fail when tokens expire');
|
|
1134
|
+
}
|
|
1135
|
+
return true;
|
|
1136
|
+
} else {
|
|
1137
|
+
const errorData = await backendResponse.text();
|
|
1138
|
+
console.error('โ YouTube auth failed:', backendResponse.status);
|
|
1139
|
+
console.error('๐ BACKEND ERROR RESPONSE:');
|
|
1140
|
+
console.error(errorData);
|
|
1141
|
+
return false;
|
|
1142
|
+
}
|
|
1143
|
+
} catch (error) {
|
|
1144
|
+
console.error('โ Google Sign-In error:', error);
|
|
1145
|
+
if (error.code === statusCodes.SIGN_IN_CANCELLED) {
|
|
1146
|
+
console.log('User cancelled Google Sign-In');
|
|
1147
|
+
} else if (error.code === statusCodes.IN_PROGRESS) {
|
|
1148
|
+
console.log('Google Sign-In already in progress');
|
|
1149
|
+
} else if (error.code === statusCodes.PLAY_SERVICES_NOT_AVAILABLE) {
|
|
1150
|
+
console.log('Google Play Services not available');
|
|
1151
|
+
}
|
|
1152
|
+
return false;
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1155
|
+
|
|
1156
|
+
// Instagram is commented out in the UI, but keeping the code for future use
|
|
1157
|
+
if (platform === 'instagram') {
|
|
1158
|
+
// Simulate Facebook Login SDK for Instagram
|
|
1159
|
+
console.log('Initiating Facebook Login for Instagram');
|
|
1160
|
+
return new Promise(resolve => {
|
|
1161
|
+
setTimeout(() => {
|
|
1162
|
+
console.log('Facebook Login completed successfully');
|
|
1163
|
+
resolve(true);
|
|
1164
|
+
}, 1000);
|
|
1165
|
+
});
|
|
1166
|
+
}
|
|
1167
|
+
return false;
|
|
1168
|
+
};
|
|
1169
|
+
|
|
1170
|
+
/**
|
|
1171
|
+
* Check if a URL is an OAuth callback
|
|
1172
|
+
*/
|
|
1173
|
+
export const isOAuthCallback = url => {
|
|
1174
|
+
return url.includes('auth/callback') || url.includes('code=');
|
|
1175
|
+
};
|
|
1176
|
+
|
|
1177
|
+
/**
|
|
1178
|
+
* Exchange authorization code for access token
|
|
1179
|
+
* This would typically be done on a server, but we're simulating it here
|
|
1180
|
+
*/
|
|
1181
|
+
export const exchangeCodeForToken = async (code, platform) => {
|
|
1182
|
+
console.log(`Exchanging code for token for platform: ${platform}`);
|
|
1183
|
+
try {
|
|
1184
|
+
// Use the proxy server to exchange the code for a token
|
|
1185
|
+
const tokenUrl = `${API_CONFIG.BASE_URL}/${platform}/token`;
|
|
1186
|
+
|
|
1187
|
+
// Make a POST request to the proxy
|
|
1188
|
+
const response = await fetch(tokenUrl, {
|
|
1189
|
+
method: 'POST',
|
|
1190
|
+
headers: {
|
|
1191
|
+
'Content-Type': 'application/json'
|
|
1192
|
+
},
|
|
1193
|
+
body: JSON.stringify({
|
|
1194
|
+
code: code,
|
|
1195
|
+
platform: platform
|
|
1196
|
+
})
|
|
1197
|
+
});
|
|
1198
|
+
if (!response.ok) {
|
|
1199
|
+
console.error(`Error exchanging code for token: ${response.status}`);
|
|
1200
|
+
throw new Error(`Token exchange failed with status ${response.status}`);
|
|
1201
|
+
}
|
|
1202
|
+
const data = await response.json();
|
|
1203
|
+
console.log(`Token exchange successful for ${platform}`);
|
|
1204
|
+
return data;
|
|
1205
|
+
} catch (error) {
|
|
1206
|
+
console.error(`Error exchanging code for token:`, error);
|
|
1207
|
+
|
|
1208
|
+
// Fallback to simulation if the API call fails
|
|
1209
|
+
console.log('Falling back to simulated token response');
|
|
1210
|
+
return {
|
|
1211
|
+
access_token: `${platform}_access_token_${Math.random().toString(36).substring(7)}`,
|
|
1212
|
+
refresh_token: `${platform}_refresh_token_${Math.random().toString(36).substring(7)}`,
|
|
1213
|
+
expires_in: 3600
|
|
1214
|
+
};
|
|
1215
|
+
}
|
|
1216
|
+
};
|
|
1217
|
+
|
|
1218
|
+
/**
|
|
1219
|
+
* Refresh YouTube tokens when they expire
|
|
1220
|
+
* This should be called when the backend reports token expiry
|
|
1221
|
+
*/
|
|
1222
|
+
export const refreshYouTubeTokens = async () => {
|
|
1223
|
+
try {
|
|
1224
|
+
var _currentUser$user3;
|
|
1225
|
+
console.log('๐ Refreshing YouTube tokens...');
|
|
1226
|
+
|
|
1227
|
+
// Get fresh tokens from Google SDK
|
|
1228
|
+
const freshTokens = await GoogleSignin.getTokens();
|
|
1229
|
+
if (!freshTokens) {
|
|
1230
|
+
console.error('โ Failed to get fresh tokens from Google SDK');
|
|
1231
|
+
return false;
|
|
1232
|
+
}
|
|
1233
|
+
|
|
1234
|
+
// Get current user info
|
|
1235
|
+
const currentUser = await GoogleSignin.getCurrentUser();
|
|
1236
|
+
if (!currentUser) {
|
|
1237
|
+
console.error('โ No current Google user found');
|
|
1238
|
+
return false;
|
|
1239
|
+
}
|
|
1240
|
+
|
|
1241
|
+
// Get stored auth token using simplified JWT storage
|
|
1242
|
+
const authToken = await getJWT();
|
|
1243
|
+
if (!authToken) {
|
|
1244
|
+
console.error('โ No auth token found for YouTube refresh');
|
|
1245
|
+
return false;
|
|
1246
|
+
}
|
|
1247
|
+
|
|
1248
|
+
// Send refreshed tokens to backend
|
|
1249
|
+
const refreshResponse = await fetch(`${API_CONFIG.BASE_URL}/youtube/refresh-token`, {
|
|
1250
|
+
method: 'POST',
|
|
1251
|
+
headers: {
|
|
1252
|
+
'Content-Type': 'application/json',
|
|
1253
|
+
'Authorization': authToken
|
|
1254
|
+
},
|
|
1255
|
+
body: JSON.stringify({
|
|
1256
|
+
accessToken: freshTokens.accessToken,
|
|
1257
|
+
idToken: freshTokens.idToken,
|
|
1258
|
+
refreshToken: currentUser.serverAuthCode,
|
|
1259
|
+
userEmail: (_currentUser$user3 = currentUser.user) === null || _currentUser$user3 === void 0 ? void 0 : _currentUser$user3.email,
|
|
1260
|
+
tokenExpiry: new Date(Date.now() + 3600 * 1000).toISOString(),
|
|
1261
|
+
// 1 hour from now
|
|
1262
|
+
timestamp: new Date().toISOString()
|
|
1263
|
+
})
|
|
1264
|
+
});
|
|
1265
|
+
if (refreshResponse.ok) {
|
|
1266
|
+
const responseData = await refreshResponse.json();
|
|
1267
|
+
console.log('โ
YouTube tokens refreshed successfully:', responseData);
|
|
1268
|
+
return true;
|
|
1269
|
+
} else {
|
|
1270
|
+
const errorData = await refreshResponse.text();
|
|
1271
|
+
console.error('โ YouTube token refresh failed:', refreshResponse.status, errorData);
|
|
1272
|
+
return false;
|
|
1273
|
+
}
|
|
1274
|
+
} catch (error) {
|
|
1275
|
+
console.error('โ Error refreshing YouTube tokens:', error);
|
|
1276
|
+
return false;
|
|
1277
|
+
}
|
|
1278
|
+
};
|
|
1279
|
+
|
|
1280
|
+
/**
|
|
1281
|
+
* Trigger training restart after YouTube re-authentication
|
|
1282
|
+
* This signals the backend to restart training with the new refresh token
|
|
1283
|
+
*/
|
|
1284
|
+
const triggerTrainingRestart = async (username, authToken) => {
|
|
1285
|
+
try {
|
|
1286
|
+
console.log('๐ [TRAINING RESTART] Triggering training restart for user:', username);
|
|
1287
|
+
const response = await fetch(`${API_CONFIG.BASE_URL}/mobile-training/restart`, {
|
|
1288
|
+
method: 'POST',
|
|
1289
|
+
headers: {
|
|
1290
|
+
'Content-Type': 'application/json',
|
|
1291
|
+
'Authorization': authToken
|
|
1292
|
+
},
|
|
1293
|
+
body: JSON.stringify({
|
|
1294
|
+
username: username,
|
|
1295
|
+
reason: 'youtube_reauth',
|
|
1296
|
+
platform: 'youtube',
|
|
1297
|
+
timestamp: new Date().toISOString(),
|
|
1298
|
+
requestNewTraining: true
|
|
1299
|
+
})
|
|
1300
|
+
});
|
|
1301
|
+
if (response.ok) {
|
|
1302
|
+
const responseData = await response.json();
|
|
1303
|
+
console.log('โ
[TRAINING RESTART] Training restart successful:', responseData);
|
|
1304
|
+
} else {
|
|
1305
|
+
const errorData = await response.text();
|
|
1306
|
+
console.error('โ [TRAINING RESTART] Training restart failed:', response.status, errorData);
|
|
1307
|
+
throw new Error(`Training restart failed: ${response.status}`);
|
|
1308
|
+
}
|
|
1309
|
+
} catch (error) {
|
|
1310
|
+
console.error('โ [TRAINING RESTART] Error triggering training restart:', error);
|
|
1311
|
+
throw error;
|
|
1312
|
+
}
|
|
1313
|
+
};
|
|
1314
|
+
|
|
1315
|
+
/**
|
|
1316
|
+
* Test function to verify YouTube refresh token functionality
|
|
1317
|
+
* Call this in your app to test the YouTube connection
|
|
1318
|
+
*/
|
|
1319
|
+
export const testYouTubeRefreshToken = async username => {
|
|
1320
|
+
console.log('๐งช Testing YouTube refresh token functionality...');
|
|
1321
|
+
console.log('๐ค User:', username);
|
|
1322
|
+
try {
|
|
1323
|
+
// Test the debug function first
|
|
1324
|
+
const debugInfo = await debugYouTubeTokens();
|
|
1325
|
+
console.log('๐ Current token status:', debugInfo);
|
|
1326
|
+
if (!debugInfo.hasRefreshToken) {
|
|
1327
|
+
console.log('โ ๏ธ No refresh token found - attempting to fix...');
|
|
1328
|
+
const success = await fixUserYouTubeConnection(username);
|
|
1329
|
+
if (success) {
|
|
1330
|
+
console.log('โ
YouTube connection fixed! Testing again...');
|
|
1331
|
+
const newDebugInfo = await debugYouTubeTokens();
|
|
1332
|
+
console.log('๐ New token status:', newDebugInfo);
|
|
1333
|
+
} else {
|
|
1334
|
+
console.error('โ Failed to fix YouTube connection');
|
|
1335
|
+
}
|
|
1336
|
+
} else {
|
|
1337
|
+
console.log('โ
Refresh token already available');
|
|
1338
|
+
}
|
|
1339
|
+
} catch (error) {
|
|
1340
|
+
console.error('โ Error testing YouTube refresh token:', error);
|
|
1341
|
+
}
|
|
1342
|
+
};
|
|
1343
|
+
|
|
1344
|
+
/**
|
|
1345
|
+
* Request email verification code
|
|
1346
|
+
*/
|
|
1347
|
+
export const requestEmailVerification = async (email, testMode = false) => {
|
|
1348
|
+
try {
|
|
1349
|
+
console.log('๐ง Requesting email verification for:', email);
|
|
1350
|
+
|
|
1351
|
+
// ๐ SECURITY: Use developer API key - backend must validate
|
|
1352
|
+
const response = await fetch(`${API_CONFIG.BASE_URL}/email/verification`, {
|
|
1353
|
+
method: 'POST',
|
|
1354
|
+
headers: getDeveloperAuthHeaders(),
|
|
1355
|
+
body: JSON.stringify({
|
|
1356
|
+
email,
|
|
1357
|
+
action: 'request',
|
|
1358
|
+
testMode
|
|
1359
|
+
})
|
|
1360
|
+
});
|
|
1361
|
+
const result = await response.json();
|
|
1362
|
+
if (response.ok) {
|
|
1363
|
+
return {
|
|
1364
|
+
success: true,
|
|
1365
|
+
message: result.message || 'Verification code sent to your email'
|
|
1366
|
+
};
|
|
1367
|
+
} else {
|
|
1368
|
+
return {
|
|
1369
|
+
success: false,
|
|
1370
|
+
error: result.message || 'Failed to send verification code'
|
|
1371
|
+
};
|
|
1372
|
+
}
|
|
1373
|
+
} catch (error) {
|
|
1374
|
+
console.error('โ Error requesting email verification:', error);
|
|
1375
|
+
return {
|
|
1376
|
+
success: false,
|
|
1377
|
+
error: 'Network error. Please check your connection and try again.'
|
|
1378
|
+
};
|
|
1379
|
+
}
|
|
1380
|
+
};
|
|
1381
|
+
|
|
1382
|
+
/**
|
|
1383
|
+
* Verify email code
|
|
1384
|
+
*/
|
|
1385
|
+
export const verifyEmailCode = async (email, code, testMode = false) => {
|
|
1386
|
+
try {
|
|
1387
|
+
console.log('๐ Verifying email code for:', email);
|
|
1388
|
+
|
|
1389
|
+
// ๐ SECURITY: Use developer API key - backend must validate before issuing JWT
|
|
1390
|
+
const response = await fetch(`${API_CONFIG.BASE_URL}/email/verification`, {
|
|
1391
|
+
method: 'POST',
|
|
1392
|
+
headers: getDeveloperAuthHeaders(),
|
|
1393
|
+
body: JSON.stringify({
|
|
1394
|
+
email,
|
|
1395
|
+
code,
|
|
1396
|
+
action: 'verify',
|
|
1397
|
+
testMode
|
|
1398
|
+
})
|
|
1399
|
+
});
|
|
1400
|
+
const result = await response.json();
|
|
1401
|
+
if (response.ok) {
|
|
1402
|
+
return {
|
|
1403
|
+
success: true,
|
|
1404
|
+
message: result.message || 'Email verified successfully',
|
|
1405
|
+
existingUser: result.existingUser || false,
|
|
1406
|
+
token: result.token
|
|
1407
|
+
};
|
|
1408
|
+
} else {
|
|
1409
|
+
return {
|
|
1410
|
+
success: false,
|
|
1411
|
+
error: result.message || 'Invalid verification code'
|
|
1412
|
+
};
|
|
1413
|
+
}
|
|
1414
|
+
} catch (error) {
|
|
1415
|
+
console.error('โ Error verifying email code:', error);
|
|
1416
|
+
return {
|
|
1417
|
+
success: false,
|
|
1418
|
+
error: 'Network error. Please check your connection and try again.'
|
|
1419
|
+
};
|
|
1420
|
+
}
|
|
1421
|
+
};
|
|
1422
|
+
|
|
1423
|
+
/**
|
|
1424
|
+
* Check email verification status
|
|
1425
|
+
*/
|
|
1426
|
+
export const checkEmailVerificationStatus = async (email, testMode = false) => {
|
|
1427
|
+
try {
|
|
1428
|
+
// ๐ SECURITY: Use developer API key - backend must validate
|
|
1429
|
+
const response = await fetch(`${API_CONFIG.BASE_URL}/email/verification/status`, {
|
|
1430
|
+
method: 'POST',
|
|
1431
|
+
headers: getDeveloperAuthHeaders(),
|
|
1432
|
+
body: JSON.stringify({
|
|
1433
|
+
email,
|
|
1434
|
+
testMode
|
|
1435
|
+
})
|
|
1436
|
+
});
|
|
1437
|
+
const result = await response.json();
|
|
1438
|
+
return {
|
|
1439
|
+
success: response.ok,
|
|
1440
|
+
isPending: result.isPending || false,
|
|
1441
|
+
message: result.message
|
|
1442
|
+
};
|
|
1443
|
+
} catch (error) {
|
|
1444
|
+
console.error('โ Error checking email verification status:', error);
|
|
1445
|
+
return {
|
|
1446
|
+
success: false,
|
|
1447
|
+
isPending: false,
|
|
1448
|
+
error: 'Network error'
|
|
1449
|
+
};
|
|
1450
|
+
}
|
|
1451
|
+
};
|
|
1452
|
+
|
|
1453
|
+
/**
|
|
1454
|
+
* Initialize platform auth service
|
|
1455
|
+
*/
|
|
1456
|
+
export const initializePlatformAuthService = () => {
|
|
1457
|
+
console.log('๐ง Platform auth service initialized');
|
|
1458
|
+
// Initialize Google Sign-In
|
|
1459
|
+
initializeGoogleSignIn();
|
|
1460
|
+
};
|
|
1461
|
+
//# sourceMappingURL=platformAuthService.js.map
|