@onairos/react-native 3.7.2 โ 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/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/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,12 +1,1484 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
Object['defineProperty'](exports,_0x3d52(0x0),{'value':!![]}),exports[_0x3d52(0x1)]=exports['testYouTubeRefreshToken']=exports[_0x3d52(0x2)]=exports[_0x3d52(0x3)]=exports['refreshYouTubeTokens']=exports[_0x3d52(0x4)]=exports[_0x3d52(0x5)]=exports[_0x3d52(0x6)]=exports[_0x3d52(0x7)]=exports[_0x3d52(0x8)]=exports[_0x3d52(0x9)]=exports[_0x3d52(0xa)]=exports[_0x3d52(0xb)]=exports[_0x3d52(0xc)]=exports['exchangeCodeForToken']=exports[_0x3d52(0xd)]=void 0x0;var _reactNative=__ONAIROS_REQ_FUNC__(0x0),_googleSignin=__ONAIROS_REQ_FUNC__(0x1),_asyncStorage=_interopRequireDefault(__ONAIROS_REQ_FUNC__(0x2)),_api=__ONAIROS_REQ_FUNC__(0x3),_apiKeyService=__ONAIROS_REQ_FUNC__(0x4),_jwtStorageService=__ONAIROS_REQ_FUNC__(0x5);function _interopRequireDefault(_0x22869a){return _0x22869a&&_0x22869a[_0x3d52(0x0)]?_0x22869a:{'default':_0x22869a};}const getDeveloperAuthHeaders=()=>{const _0x5a3886={'NJHVc':_0x3d52(0xe),'ErdGC':function(_0x1f450f,_0x476c9f){return _0x1f450f===_0x476c9f;},'qWgHI':_0x3d52(0xf),'HfTLW':_0x3d52(0x10),'JfEHA':_0x3d52(0x11),'ZHjwo':function(_0x4d975c,_0x579563){return _0x4d975c!==_0x579563;},'ycNFQ':_0x3d52(0x12),'JMNDD':_0x3d52(0x13)};if(!(0x0,_apiKeyService[_0x3d52(0x14)])()){if(_0x5a3886[_0x3d52(0x15)](_0x5a3886['qWgHI'],_0x5a3886['HfTLW']))_0x8ba403['api2Test']={'success':![],'error':_0x4a2559[_0x3d52(0x16)],'name':_0x4415bb[_0x3d52(0x17)]},_0x4076e6[_0x3d52(0x18)](_0x5a3886[_0x3d52(0x19)],_0x164e07[_0x3d52(0x16)]);else throw new Error(_0x5a3886[_0x3d52(0x1a)]);}const _0x223203=(0x0,_apiKeyService[_0x3d52(0x1b)])();if(!(_0x5a3886[_0x3d52(0x1c)](_0x223203,null)&&_0x5a3886[_0x3d52(0x1c)](_0x223203,void 0x0)&&_0x223203[_0x3d52(0x1d)]))throw new Error(_0x5a3886[_0x3d52(0x1e)]);return{...(0x0,_api[_0x3d52(0x1f)])(),'Authorization':_0x3d52(0x20)+_0x223203[_0x3d52(0x1d)],'X-SDK-Version':_0x5a3886[_0x3d52(0x21)],'X-SDK-Platform':'react-native'};},WEB_CLIENT_ID=_0x3d52(0x22),IOS_CLIENT_ID=_0x3d52(0x22),OAUTH_CONFIG={'instagram':{'authUrl':'https://api.instagram.com/oauth/authorize','clientId':_0x3d52(0x23),'redirectUri':_0x3d52(0x24),'scope':_0x3d52(0x25),'responseType':'code','hasNativeSDK':![]},'youtube':{'authUrl':_api[_0x3d52(0x26)][_0x3d52(0x27)]+_0x3d52(0x28),'clientId':'1030678346906-lovkuds2ouqmoc8eu5qpo98spa6edv4o.apps.googleusercontent.com','redirectUri':_0x3d52(0x24),'scope':_0x3d52(0x29),'responseType':_0x3d52(0x2a),'hasNativeSDK':!![]},'reddit':{'authUrl':_api[_0x3d52(0x26)]['BASE_URL']+_0x3d52(0x2b),'clientId':_0x3d52(0x2c),'redirectUri':_0x3d52(0x24),'scope':_0x3d52(0x2d),'responseType':_0x3d52(0x2a),'hasNativeSDK':![]},'pinterest':{'authUrl':_api['API_CONFIG'][_0x3d52(0x27)]+_0x3d52(0x2e),'clientId':'demo_pinterest_client_id','redirectUri':'onairosevents://auth/callback','scope':_0x3d52(0x2f),'responseType':'code','hasNativeSDK':![]},'facebook':{'authUrl':'https://www.facebook.com/v12.0/dialog/oauth','clientId':_0x3d52(0x30),'redirectUri':_0x3d52(0x24),'scope':_0x3d52(0x31),'responseType':_0x3d52(0x2a),'hasNativeSDK':![]},'linkedin':{'authUrl':_api[_0x3d52(0x26)][_0x3d52(0x27)]+_0x3d52(0x32),'clientId':'','redirectUri':'onairosevents://auth/callback','scope':_0x3d52(0x33),'responseType':_0x3d52(0x2a),'hasNativeSDK':![]},'gmail':{'authUrl':_api['API_CONFIG'][_0x3d52(0x27)]+_0x3d52(0x34),'clientId':'demo_gmail_client_id','redirectUri':'onairosevents://auth/callback','scope':'https://www.googleapis.com/auth/gmail.readonly','responseType':_0x3d52(0x2a),'hasNativeSDK':![]},'email':{'hasNativeSDK':![],'authUrl':_api[_0x3d52(0x26)][_0x3d52(0x27)]+_0x3d52(0x35)},'chatgpt':{'authUrl':_0x3d52(0x36),'clientId':'','redirectUri':'','scope':'','responseType':'','hasNativeSDK':![]},'claude':{'authUrl':_0x3d52(0x37),'clientId':'','redirectUri':'','scope':'','responseType':'','hasNativeSDK':![]},'gemini':{'authUrl':'https://gemini.google.com','clientId':'','redirectUri':'','scope':'','responseType':'','hasNativeSDK':![]},'grok':{'authUrl':_0x3d52(0x38),'clientId':'','redirectUri':'','scope':'','responseType':'','hasNativeSDK':![]},'hinge':{'authUrl':'https://hinge.co','clientId':'','redirectUri':'','scope':'','responseType':'','hasNativeSDK':![]},'instagram_webview':{'authUrl':_0x3d52(0x39),'clientId':'','redirectUri':'','scope':'','responseType':'','hasNativeSDK':![]},'sephora':{'authUrl':_0x3d52(0x3a),'clientId':'','redirectUri':'','scope':'','responseType':'','hasNativeSDK':![]},'telegram':{'authUrl':_0x3d52(0x3b),'clientId':'','redirectUri':'','scope':'','responseType':'','hasNativeSDK':![]}},hasNativeSDK=_0x144f31=>{const _0x119d9e={'dSiCd':function(_0x160d4f,_0x45fe39){return _0x160d4f===_0x45fe39;}};var _0x38cf54;return(_0x119d9e[_0x3d52(0x3c)](_0x38cf54=OAUTH_CONFIG[_0x144f31],null)||_0x119d9e[_0x3d52(0x3c)](_0x38cf54,void 0x0)?void 0x0:_0x38cf54[_0x3d52(0x9)])||![];};exports[_0x3d52(0x9)]=hasNativeSDK;const testApiConnectivity=async()=>{const _0x2e4c66={'xigJD':_0x3d52(0x3d),'ruyhe':_0x3d52(0x3e),'UUInV':function(_0x226f95,_0x127765,_0x4cbd36){return _0x226f95(_0x127765,_0x4cbd36);},'Ktcdr':'HEAD','JAbCg':_0x3d52(0x3f),'DydBZ':_0x3d52(0x40),'NNQmp':'๐\x20[CONNECTIVITY]\x20Test\x202:\x20Checking\x20API\x20server...','hkIIL':function(_0x4b8e3a,_0x22549e){return _0x4b8e3a===_0x22549e;},'okzjl':_0x3d52(0x41),'ESleZ':function(_0x5c9c44,_0x26df08,_0x54ec8f){return _0x5c9c44(_0x26df08,_0x54ec8f);},'xsoVY':function(_0x14f2b0,_0x423320){return _0x14f2b0(_0x423320);},'nzirX':_0x3d52(0x42),'BOoFw':_0x3d52(0xe),'kWOVF':function(_0x2fa930,_0x2b1551){return _0x2fa930!==_0x2b1551;},'IwDDr':function(_0x3f2577,_0x3cb8ba){return _0x3f2577!==_0x3cb8ba;},'qrnFH':_0x3d52(0x43),'GpAoM':_0x3d52(0x44),'nmQve':_0x3d52(0x45)},_0x27baea={'googleTest':null,'api2Test':null};try{var _0x4fcf9f,_0x2f11b3;console[_0x3d52(0x46)](_0x2e4c66[_0x3d52(0x47)]),console[_0x3d52(0x46)](_0x2e4c66['ruyhe']);try{const _0xdff473=await _0x2e4c66[_0x3d52(0x48)](fetch,_0x3d52(0x49),{'method':_0x2e4c66[_0x3d52(0x4a)],'mode':_0x3d52(0x4b)});_0x27baea[_0x3d52(0x4c)]={'success':!![],'status':_0x2e4c66['JAbCg']},console[_0x3d52(0x46)](_0x3d52(0x4d));}catch(_0x2d25ab){if(_0x2e4c66[_0x3d52(0x4e)]===_0x3d52(0x40))_0x27baea['googleTest']={'success':![],'error':_0x2d25ab[_0x3d52(0x16)]},console[_0x3d52(0x18)](_0x3d52(0x4f),_0x2d25ab[_0x3d52(0x16)]);else return _0x472df1[_0x3d52(0x18)](_0x3d52(0x50),_0x39aa15),null;}console['log'](_0x2e4c66[_0x3d52(0x51)]);try{if(_0x2e4c66['hkIIL'](_0x2e4c66[_0x3d52(0x52)],_0x3d52(0x41))){const _0x46e225=new AbortController(),_0x147a86=_0x2e4c66[_0x3d52(0x48)](setTimeout,()=>_0x46e225[_0x3d52(0x53)](),0x7530),_0x46fdcb=await _0x2e4c66[_0x3d52(0x54)](fetch,_api[_0x3d52(0x26)][_0x3d52(0x27)]+_0x3d52(0x55),{'method':'GET','signal':_0x46e225[_0x3d52(0x56)]});_0x2e4c66[_0x3d52(0x57)](clearTimeout,_0x147a86);const _0x307807=await _0x46fdcb[_0x3d52(0x58)]()[_0x3d52(0x59)](()=>'Unable\x20to\x20read\x20response');_0x27baea[_0x3d52(0x5a)]={'success':_0x46fdcb['ok'],'status':_0x46fdcb['status'],'statusText':_0x46fdcb[_0x3d52(0x5b)],'response':_0x307807[_0x3d52(0x5c)](0x0,0xc8)},_0x46fdcb['ok']?console[_0x3d52(0x46)](_0x2e4c66['nzirX']):console[_0x3d52(0x46)](_0x3d52(0x5d)+_0x46fdcb[_0x3d52(0x5e)]);}else _0x2e93d8['warn'](_0x3d52(0x5f));}catch(_0x130157){_0x27baea[_0x3d52(0x5a)]={'success':![],'error':_0x130157[_0x3d52(0x16)],'name':_0x130157['name']},console[_0x3d52(0x18)](_0x2e4c66['BOoFw'],_0x130157[_0x3d52(0x16)]);}if(_0x2e4c66[_0x3d52(0x60)](_0x4fcf9f=_0x27baea['api2Test'],null)&&_0x2e4c66[_0x3d52(0x61)](_0x4fcf9f,void 0x0)&&_0x4fcf9f[_0x3d52(0x62)])return{'success':!![],'message':_0x2e4c66['qrnFH'],'details':_0x27baea};else return(_0x2f11b3=_0x27baea['googleTest'])!==null&&_0x2e4c66['kWOVF'](_0x2f11b3,void 0x0)&&_0x2f11b3[_0x3d52(0x62)]?{'success':![],'message':_0x2e4c66[_0x3d52(0x63)],'details':_0x27baea}:{'success':![],'message':_0x3d52(0x64),'details':_0x27baea};}catch(_0x160ee7){return console[_0x3d52(0x18)](_0x2e4c66[_0x3d52(0x65)],_0x160ee7[_0x3d52(0x16)]),{'success':![],'message':_0x3d52(0x66)+_0x160ee7[_0x3d52(0x16)],'details':{'error':_0x160ee7[_0x3d52(0x16)],'results':_0x27baea}};}};exports[_0x3d52(0x2)]=testApiConnectivity;const initiateOAuth=async(_0x22d19e,_0x3635c5)=>{const _0x54b2fb={'jaziV':_0x3d52(0x67),'wMcwo':'code=','vfmnK':'๐\x20[YOUTUBE\x20AUTH]\x20YouTube\x20connected\x20in\x20temporary\x20mode','YxWeM':_0x3d52(0x68),'WgVum':_0x3d52(0x69),'IJsEl':function(_0x4bc839,_0xa09495){return _0x4bc839===_0xa09495;},'gIQNM':'email','wKokC':'๐ง\x20[OAUTH]\x20Email\x20platform\x20selected,\x20returning\x20mock\x20auth\x20URL','lpHCN':_0x3d52(0x6a),'qxvvz':_0x3d52(0x6b),'BThpp':function(_0x1e0b22,_0x16a963,_0x4230a1){return _0x1e0b22(_0x16a963,_0x4230a1);},'VVyVn':function(_0x1e63c6,_0x69b147,_0x284937){return _0x1e63c6(_0x69b147,_0x284937);},'CZRld':function(_0x16d108,_0x20e071){return _0x16d108(_0x20e071);},'hWEkD':_0x3d52(0x6c),'BfwXw':_0x3d52(0x6d),'qFEhA':_0x3d52(0x6e),'WADdd':function(_0x51ee34,_0x7cae71){return _0x51ee34!==_0x7cae71;},'hjTlR':_0x3d52(0x6f),'iNhau':_0x3d52(0x70),'oHNty':_0x3d52(0x71),'ntcXG':_0x3d52(0x72),'YmDNR':'\x20\x20\x205.\x20iOS\x20simulator\x20network\x20sandbox\x20issue\x20-\x20try\x20on\x20physical\x20device','WtYak':_0x3d52(0x73)};try{if(_0x3d52(0x74)===_0x54b2fb[_0x3d52(0x75)])_0x4a0100[_0x3d52(0x46)](_0x3d52(0x76));else{console[_0x3d52(0x46)]('๐\x20[OAUTH]\x20Starting\x20OAuth\x20for\x20platform:\x20'+_0x22d19e),console['log'](_0x3d52(0x77)+_reactNative[_0x3d52(0x78)]['OS']+_0x3d52(0x79)+_reactNative['Platform'][_0x3d52(0x7a)]);if(_0x54b2fb[_0x3d52(0x7b)](_0x22d19e,_0x54b2fb[_0x3d52(0x7c)]))return console[_0x3d52(0x46)](_0x54b2fb[_0x3d52(0x7d)]),_api[_0x3d52(0x26)][_0x3d52(0x27)]+_0x3d52(0x7e);let _0x16915d;try{if(_0x54b2fb['lpHCN']!==_0x54b2fb['qxvvz'])_0x16915d=await(0x0,_api['getUserAuthHeaders'])(),console[_0x3d52(0x46)](_0x3d52(0x7f));else return _0x155632['includes'](_0x54b2fb[_0x3d52(0x80)])||_0x2ede42['includes'](_0x54b2fb[_0x3d52(0x81)]);}catch(_0x4eb1d8){return console[_0x3d52(0x18)](_0x3d52(0x82)+_0x22d19e+_0x3d52(0x83)),console[_0x3d52(0x18)](_0x3d52(0x84)),null;}const _0xbb0351=_api['API_CONFIG'][_0x3d52(0x27)]+'/'+_0x22d19e+'/authorize';console[_0x3d52(0x46)](_0x3d52(0x85)+_0xbb0351),console['log'](_0x3d52(0x86));const _0xb4d188={'platform':_0x22d19e,'timestamp':new Date()['toISOString']()};console[_0x3d52(0x46)](_0x3d52(0x87),_0xb4d188);const _0x50a9df=new AbortController(),_0x296086=_0x54b2fb[_0x3d52(0x88)](setTimeout,()=>{console[_0x3d52(0x46)](_0x3d52(0x89)+_0x22d19e+_0x3d52(0x8a)),_0x50a9df[_0x3d52(0x53)]();},0x7530),_0x35d132=await _0x54b2fb[_0x3d52(0x8b)](fetch,_0xbb0351,{'method':'POST','headers':_0x16915d,'body':JSON[_0x3d52(0x8c)](_0xb4d188),'signal':_0x50a9df[_0x3d52(0x56)]});_0x54b2fb[_0x3d52(0x8d)](clearTimeout,_0x296086),console['log']('๐ก\x20[OAUTH]\x20Response\x20status:\x20'+_0x35d132[_0x3d52(0x5e)]+'\x20'+_0x35d132['statusText']);if(!_0x35d132['ok']){if(_0x54b2fb['hWEkD']!==_0x54b2fb['BfwXw']){const _0x49e3a5=await _0x35d132[_0x3d52(0x58)]();return console[_0x3d52(0x18)](_0x3d52(0x8e)+_0x22d19e+':\x20'+_0x35d132[_0x3d52(0x5e)]+_0x3d52(0x8f)+_0x49e3a5),null;}else _0x258e16[_0x3d52(0x46)](_0x54b2fb['vfmnK']),_0x47d1ed['log'](_0x3d52(0x90)),_0x59482a[_0x3d52(0x46)](_0x54b2fb[_0x3d52(0x91)]);}const _0x52995c=await _0x35d132['json']();console[_0x3d52(0x46)](_0x3d52(0x92)+_0x22d19e+':',_0x52995c);const _0x101425=_0x22d19e+_0x3d52(0x93),_0x5e3348=_0x52995c[_0x101425]||_0x52995c[_0x3d52(0x94)]||null;return console[_0x3d52(0x46)](_0x3d52(0x95)+_0x22d19e+'\x20(key:\x20'+_0x101425+'):',_0x5e3348),_0x5e3348;}}catch(_0x598296){var _0x28c143;if(_0x598296[_0x3d52(0x17)]===_0x54b2fb['qFEhA'])console['error'](_0x3d52(0x96)+_0x22d19e+'\x20-\x20the\x20server\x20took\x20too\x20long\x20to\x20respond');else{if(_0x54b2fb[_0x3d52(0x97)](_0x28c143=_0x598296['message'],null)&&_0x28c143!==void 0x0&&_0x28c143['includes'](_0x54b2fb['hjTlR'])){const _0xf500e7=_0x54b2fb[_0x3d52(0x98)][_0x3d52(0x99)]('|');let _0x1579b4=0x0;while(!![]){switch(_0xf500e7[_0x1579b4++]){case'0':console[_0x3d52(0x18)](_0x54b2fb['oHNty']);continue;case'1':console[_0x3d52(0x18)](_0x54b2fb[_0x3d52(0x9a)]);continue;case'2':console[_0x3d52(0x18)](_0x3d52(0x9b)+_0x22d19e+_0x3d52(0x9c));continue;case'3':console[_0x3d52(0x18)](_0x54b2fb[_0x3d52(0x9d)]);continue;case'4':console[_0x3d52(0x18)]('\x20\x20\x203.\x20DNS\x20resolution\x20failed');continue;case'5':console['error'](_0x54b2fb[_0x3d52(0x9e)]);continue;}break;}}else console[_0x3d52(0x18)](_0x3d52(0x8e)+_0x22d19e+':',_0x598296);}return null;}};exports[_0x3d52(0x6)]=initiateOAuth;const initializeGoogleSignIn=()=>{const _0x41eef5={'KNPXb':_0x3d52(0x9f),'pSRML':_0x3d52(0xa0),'oVnUB':_0x3d52(0xa1)};_googleSignin[_0x3d52(0xa2)][_0x3d52(0xa3)]({'webClientId':WEB_CLIENT_ID,'iosClientId':IOS_CLIENT_ID,'offlineAccess':!![],'forceCodeForRefreshToken':!![],'scopes':[_0x3d52(0x29),_0x41eef5['KNPXb'],_0x41eef5['pSRML'],_0x41eef5[_0x3d52(0xa4)]],'hostedDomain':'','accountName':''});},forceYouTubeReconnectionWithConsent=async _0x2c9284=>{const _0x18e70b={'GcuoV':_0x3d52(0xa5),'gcPsV':_0x3d52(0xa6),'SgbsO':_0x3d52(0xa7),'XZUcd':_0x3d52(0x11),'pjCoD':function(_0x55a4e7,_0x47d289){return _0x55a4e7!==_0x47d289;},'ZCUoV':function(_0x377e47,_0x58708f){return _0x377e47!==_0x58708f;},'qpeYJ':_0x3d52(0x13),'lRwbq':_0x3d52(0xa8),'VHgVO':_0x3d52(0xa9),'fSJha':'โน๏ธ\x20No\x20token\x20cache\x20to\x20clear','KyAkX':function(_0x32e9c5,_0x1fdfa4){return _0x32e9c5===_0x1fdfa4;},'DmxAh':_0x3d52(0xaa),'odDjh':_0x3d52(0xab),'mYwcp':'โ
\x20Signed\x20out\x20-\x20consent\x20cache\x20cleared','uXYQj':'โ
\x20Token\x20cache\x20cleared','DOddg':_0x3d52(0xac),'MxuOi':_0x3d52(0x29),'hFdOK':_0x3d52(0x9f),'JMNIV':'profile','RmYjc':_0x3d52(0xa1),'KSSzC':_0x3d52(0xad),'eJcPU':_0x3d52(0xae),'LFloA':'๐ฑ\x20User\x20should\x20see:\x20\x22Allow\x20[App]\x20to\x20access\x20your\x20YouTube\x20account\x20when\x20you\x27re\x20not\x20using\x20the\x20app?\x22','ayUoH':_0x3d52(0xaf),'DKJJC':_0x3d52(0xb0),'SSpqM':function(_0x439c2e,_0x32ebdd){return _0x439c2e===_0x32ebdd;},'owOHV':'๐\x20FULL\x20userInfo\x20object\x20from\x20forceYouTubeReconnectionWithConsent:','XDubw':_0x3d52(0xb1),'kgyzi':'๐\x20FULL\x20currentUser\x20object\x20from\x20forceYouTubeReconnectionWithConsent:','adCOU':_0x3d52(0xb2),'bCyPH':'-\x20Access\x20token:','trihc':'-\x20ID\x20token:','lVqel':_0x3d52(0xb3),'kmKRQ':_0x3d52(0xb4),'VTChQ':function(_0x40bf0b,_0x142ea6){return _0x40bf0b!==_0x142ea6;},'JdvrL':'Missing','TuIlq':_0x3d52(0xb5),'wMvZH':function(_0x4bce9c,_0x18133a){return _0x4bce9c!==_0x18133a;},'xFybV':function(_0xba4092,_0x429a2d){return _0xba4092!==_0x429a2d;},'bFNoy':function(_0x5ac8c3,_0x293122){return _0x5ac8c3===_0x293122;},'pvAot':function(_0x1bb0fe,_0xe497fd){return _0x1bb0fe===_0xe497fd;},'ojxAC':_0x3d52(0xb6),'ewUAJ':_0x3d52(0xb7),'QqBCn':_0x3d52(0xb8),'cWhxq':_0x3d52(0xb9),'BItIP':function(_0x1e6687,_0xdc12d4){return _0x1e6687!==_0xdc12d4;},'kxbqj':_0x3d52(0xba),'OkEhB':function(_0x1bd0d2,_0x66b87c,_0x192893){return _0x1bd0d2(_0x66b87c,_0x192893);},'gLXlP':_0x3d52(0xbb),'YSnPO':_0x3d52(0xbc),'XTqjY':_0x3d52(0xbd),'zwghV':_0x3d52(0xbe),'ygepQ':_0x3d52(0xbf),'QNFlq':function(_0x5e539a,_0x423e24){return _0x5e539a===_0x423e24;},'jYfdX':function(_0x1f588d,_0x3c7483){return _0x1f588d===_0x3c7483;},'Wezjl':_0x3d52(0xc0),'KJUHa':_0x3d52(0xc1),'bwrvf':function(_0x24b4a9,_0x3c0f23){return _0x24b4a9===_0x3c0f23;},'KMdrb':function(_0x515905,_0x19f515){return _0x515905===_0x19f515;},'yDYTA':function(_0x34b552,_0x30988e){return _0x34b552===_0x30988e;},'qcKDT':function(_0x3d06df,_0x44e21e){return _0x3d06df===_0x44e21e;},'OOOIE':_0x3d52(0xc2),'qMiaH':function(_0x188e6a,_0x2714a6){return _0x188e6a===_0x2714a6;},'XsZWi':function(_0x38df77,_0x29603f){return _0x38df77===_0x29603f;},'QmvZC':function(_0x4dc19a,_0x3a4217){return _0x4dc19a===_0x3a4217;},'lMtam':function(_0x168cb4,_0x22e9a4){return _0x168cb4===_0x22e9a4;},'AacxY':_0x3d52(0xc3),'uTryA':function(_0x52908d,_0x533908){return _0x52908d===_0x533908;},'rHOPY':function(_0x39b6ce,_0x32acf7){return _0x39b6ce===_0x32acf7;},'NCOrJ':function(_0x108fcb,_0x3fe5e7){return _0x108fcb===_0x3fe5e7;},'UGuqN':function(_0x308e23,_0x1fca98){return _0x308e23===_0x1fca98;},'JVRyl':function(_0xbc7152,_0x1b9c84){return _0xbc7152===_0x1b9c84;},'CBqGc':function(_0x9acad9,_0x591ff2){return _0x9acad9+_0x591ff2;},'AeXXM':function(_0x3c41c4,_0x4af672){return _0x3c41c4*_0x4af672;},'nHWkf':_0x3d52(0xc4),'PMZVT':_0x3d52(0xc5),'bxEQg':_0x3d52(0xc6),'Wabus':function(_0xe8c936,_0x5be731){return _0xe8c936===_0x5be731;},'yrcUm':_0x3d52(0xc7),'uWitL':_0x3d52(0xc8),'yHMyD':'๐\x20[YOUTUBE\x20REAUTH]\x20Headers:','pesTz':_0x3d52(0xc9),'vxjFL':_0x3d52(0xca),'yjhgK':function(_0x542cf8,_0x6e7617){return _0x542cf8===_0x6e7617;},'MncNd':function(_0x172990,_0x1593e4){return _0x172990===_0x1593e4;},'xNDeR':_0x3d52(0xcb),'aiMii':function(_0x1f3d2d,_0x5b2d82){return _0x1f3d2d&&_0x5b2d82;},'rSUGC':_0x3d52(0xcc),'RbBnS':_0x3d52(0xcd),'wrGmG':'โ
\x20[YOUTUBE\x20REAUTH]\x20Backend\x20Response\x20SUCCESS:','eWaLN':function(_0x486497,_0x43da9f){return _0x486497===_0x43da9f;},'zRvRS':function(_0x596b85,_0x2f09aa){return _0x596b85===_0x2f09aa;},'pughz':function(_0x56aeae,_0x4aa70a){return _0x56aeae===_0x4aa70a;},'jsqou':_0x3d52(0xce),'VHRnZ':_0x3d52(0xcf),'TrgGI':_0x3d52(0xd0),'JrVfH':_0x3d52(0xd1),'TQhQI':_0x3d52(0xd2),'LoDKc':_0x3d52(0xd3),'nfPNj':_0x3d52(0xd4),'PSPTW':_0x3d52(0xd5),'AEFbz':_0x3d52(0xd6),'YcEjh':_0x3d52(0xd7),'VsqWU':_0x3d52(0xd8),'vDvYb':_0x3d52(0xd9),'WysLo':_0x3d52(0xda),'EWLtl':_0x3d52(0xdb),'HwgBQ':_0x3d52(0xdc),'QpoEE':_0x3d52(0xdd),'wGnFv':_0x3d52(0xde),'UwvKf':_0x3d52(0xdf),'MGqhC':function(_0x18bbe9,_0x2ee78b){return _0x18bbe9===_0x2ee78b;},'GeZyf':_0x3d52(0xe0),'JuPoW':function(_0x2e93fb,_0x115282){return _0x2e93fb===_0x115282;},'bXLOg':_0x3d52(0xe1),'JuEGG':_0x3d52(0xe2),'UaEoj':'โ ๏ธ\x20[YOUTUBE\x20REAUTH]\x20User\x20may\x20need\x20to\x20manually\x20restart\x20training','zFOtW':'โ\x20[YOUTUBE\x20REAUTH]\x20Backend\x20processing\x20FAILED:','BRsCX':_0x3d52(0xe3),'xkOvG':_0x3d52(0xe4),'YlRnT':_0x3d52(0xe5),'mgmbT':_0x3d52(0xe6),'ZkhGT':_0x3d52(0xe7),'EjoTm':'โ\x20CRITICAL:\x20No\x20refresh\x20token\x20even\x20after\x20consent\x20screen','WObCw':_0x3d52(0xe8),'rvfys':_0x3d52(0xe9),'vZERP':_0x3d52(0xea),'FjgCf':_0x3d52(0xeb),'jmMTw':function(_0x1cdf6b,_0x1fe2bc){return _0x1cdf6b===_0x1fe2bc;},'iCSpu':_0x3d52(0xec),'qmOoG':_0x3d52(0xed),'FvxuA':function(_0x3b9462,_0x1039ef){return _0x3b9462===_0x1039ef;},'RCCsu':_0x3d52(0xee),'DwgRL':_0x3d52(0xef)};try{if(_0x18e70b[_0x3d52(0xf0)](_0x18e70b[_0x3d52(0xf1)],'vEKVO'))_0x32a6d8['log'](_0x18e70b[_0x3d52(0xf2)],_0x13a694);else{var _0x94df75,_0x4b6387,_0x5adb97;console[_0x3d52(0x46)](_0x18e70b[_0x3d52(0xf3)]),console[_0x3d52(0x46)]('๐ค\x20User:',_0x2c9284);try{await _googleSignin[_0x3d52(0xa2)]['signOut'](),console[_0x3d52(0x46)](_0x18e70b[_0x3d52(0xf4)]);}catch(_0x1a6693){console[_0x3d52(0x46)](_0x18e70b['GcuoV'],_0x1a6693);}try{const _0x2b8519=await _googleSignin[_0x3d52(0xa2)]['getTokens']();_0x2b8519[_0x3d52(0xf5)]&&(await _googleSignin['GoogleSignin'][_0x3d52(0xf6)](_0x2b8519['accessToken']),console[_0x3d52(0x46)](_0x18e70b[_0x3d52(0xf7)]));}catch(_0x588e03){console[_0x3d52(0x46)](_0x18e70b['fSJha']);}console[_0x3d52(0x46)](_0x18e70b[_0x3d52(0xf8)]),_googleSignin[_0x3d52(0xa2)][_0x3d52(0xa3)]({'webClientId':WEB_CLIENT_ID,'iosClientId':IOS_CLIENT_ID,'offlineAccess':!![],'forceCodeForRefreshToken':!![],'scopes':[_0x18e70b['MxuOi'],_0x18e70b['hFdOK'],_0x18e70b[_0x3d52(0xf9)],_0x18e70b[_0x3d52(0xfa)]],'hostedDomain':'','accountName':''}),await _googleSignin[_0x3d52(0xa2)][_0x3d52(0xfb)](),console[_0x3d52(0x46)](_0x18e70b['KSSzC']),console[_0x3d52(0x46)](_0x18e70b['eJcPU']),console[_0x3d52(0x46)](_0x18e70b[_0x3d52(0xfc)]);const _0x20a14f=await _googleSignin[_0x3d52(0xa2)]['signIn']();console[_0x3d52(0x46)](_0x18e70b[_0x3d52(0xfd)]),console[_0x3d52(0x46)](_0x18e70b[_0x3d52(0xfe)],(_0x94df75=_0x20a14f[_0x3d52(0xff)])===null||_0x18e70b[_0x3d52(0xf0)](_0x94df75,void 0x0)||_0x18e70b['KyAkX'](_0x94df75=_0x94df75['user'],null)||_0x18e70b['SSpqM'](_0x94df75,void 0x0)?void 0x0:_0x94df75[_0x3d52(0xa1)]);const _0x576cf1=await _googleSignin[_0x3d52(0xa2)][_0x3d52(0x100)](),_0x22d129=await _googleSignin[_0x3d52(0xa2)][_0x3d52(0x101)]();console['log'](_0x18e70b[_0x3d52(0x102)]),console[_0x3d52(0x46)](JSON[_0x3d52(0x8c)](_0x20a14f,null,0x2)),console['log'](_0x18e70b['XDubw']),console[_0x3d52(0x46)](JSON[_0x3d52(0x8c)](_0x576cf1,null,0x2)),console[_0x3d52(0x46)](_0x18e70b[_0x3d52(0x103)]),console['log'](JSON[_0x3d52(0x8c)](_0x22d129,null,0x2)),console[_0x3d52(0x46)](_0x18e70b[_0x3d52(0x104)]),console[_0x3d52(0x46)](_0x18e70b[_0x3d52(0x105)],_0x576cf1[_0x3d52(0xf5)]?_0x576cf1[_0x3d52(0xf5)][_0x3d52(0x5c)](0x0,0x14)+'...':_0x3d52(0x106)),console[_0x3d52(0x46)](_0x18e70b[_0x3d52(0x107)],_0x576cf1[_0x3d52(0x108)]?_0x18e70b[_0x3d52(0x109)]:'Missing'),console['log'](_0x18e70b[_0x3d52(0x10a)],_0x18e70b[_0x3d52(0x10b)](_0x4b6387=_0x20a14f['data'],null)&&_0x4b6387!==void 0x0&&_0x4b6387[_0x3d52(0xc4)]?_0x20a14f[_0x3d52(0xff)][_0x3d52(0xc4)]['substring'](0x0,0x14)+_0x3d52(0x10c):_0x18e70b[_0x3d52(0x10d)]),console[_0x3d52(0x46)](_0x18e70b['TuIlq'],_0x18e70b[_0x3d52(0x10e)](_0x22d129,null)&&_0x18e70b[_0x3d52(0x10f)](_0x22d129,void 0x0)&&_0x22d129[_0x3d52(0xc4)]?_0x22d129[_0x3d52(0xc4)][_0x3d52(0x5c)](0x0,0x14)+_0x3d52(0x10c):_0x3d52(0x106));const _0x5849a7=(_0x18e70b[_0x3d52(0x110)](_0x5adb97=_0x20a14f[_0x3d52(0xff)],null)||_0x18e70b[_0x3d52(0x111)](_0x5adb97,void 0x0)?void 0x0:_0x5adb97[_0x3d52(0xc4)])||(_0x22d129===null||_0x18e70b['bFNoy'](_0x22d129,void 0x0)?void 0x0:_0x22d129[_0x3d52(0xc4)]);if(_0x5849a7){var _0x307e22,_0x525298,_0x5ecc22,_0xea8b0c,_0x34b19d,_0x2d90aa;console[_0x3d52(0x46)](_0x18e70b[_0x3d52(0x112)]),console['log'](_0x18e70b[_0x3d52(0x113)],_0x5849a7[_0x3d52(0x114)]('4/')?_0x3d52(0xc4):_0x18e70b['QqBCn']),console[_0x3d52(0x46)](_0x3d52(0x115),_0x5849a7[_0x3d52(0x5c)](0x0,0x14)+_0x3d52(0x10c));let _0x254698=_0x18e70b[_0x3d52(0x116)],_0x598699=null;try{if(_0x18e70b[_0x3d52(0x117)](_0x18e70b['kxbqj'],_0x18e70b[_0x3d52(0x118)]))return _0x3a416b[_0x3d52(0x18)](_0x18e70b[_0x3d52(0x119)],_0x2e15ef),{'success':![],'error':_0x18e70b['SgbsO']};else{console['log']('๐บ\x20Fetching\x20YouTube\x20channel\x20information...');const _0x357683=await _0x18e70b[_0x3d52(0x11a)](fetch,_0x18e70b[_0x3d52(0x11b)],{'headers':{'Authorization':_0x3d52(0x20)+_0x576cf1[_0x3d52(0xf5)],'Accept':'application/json'}});if(_0x357683['ok']){if(_0x18e70b['pvAot'](_0x18e70b[_0x3d52(0x11c)],_0x18e70b[_0x3d52(0x11c)])){const _0x9d3a7b=await _0x357683['json']();if(_0x9d3a7b['items']&&_0x9d3a7b[_0x3d52(0x11d)][_0x3d52(0x11e)]>0x0)_0x254698=_0x9d3a7b['items'][0x0][_0x3d52(0x11f)][_0x3d52(0x120)],_0x598699=_0x9d3a7b[_0x3d52(0x11d)][0x0]['id'],console[_0x3d52(0x46)](_0x18e70b[_0x3d52(0x121)],_0x254698,_0x18e70b[_0x3d52(0x122)],_0x598699);else{var _0x421a97,_0x40a149;console[_0x3d52(0x46)](_0x18e70b[_0x3d52(0x123)]),_0x254698=(_0x18e70b[_0x3d52(0x124)](_0x421a97=_0x20a14f[_0x3d52(0xff)],null)||_0x18e70b[_0x3d52(0x124)](_0x421a97,void 0x0)||_0x18e70b[_0x3d52(0x111)](_0x421a97=_0x421a97[_0x3d52(0x125)],null)||_0x18e70b[_0x3d52(0x110)](_0x421a97,void 0x0)?void 0x0:_0x421a97[_0x3d52(0x17)])||(_0x18e70b['jYfdX'](_0x40a149=_0x20a14f[_0x3d52(0xff)],null)||_0x40a149===void 0x0||(_0x40a149=_0x40a149[_0x3d52(0x125)])===null||_0x40a149===void 0x0?void 0x0:_0x40a149[_0x3d52(0xa1)])||_0x18e70b['Wezjl'];}}else return _0x18292a[_0x3d52(0x18)]('โ\x20Error\x20refreshing\x20YouTube\x20tokens:',_0x240f5c),![];}else{var _0x281625,_0x9ef8fb;console[_0x3d52(0x46)](_0x18e70b[_0x3d52(0x126)],_0x357683['status']),_0x254698=(_0x18e70b[_0x3d52(0x127)](_0x281625=_0x20a14f[_0x3d52(0xff)],null)||_0x18e70b[_0x3d52(0x128)](_0x281625,void 0x0)||_0x18e70b['jYfdX'](_0x281625=_0x281625[_0x3d52(0x125)],null)||_0x18e70b['yDYTA'](_0x281625,void 0x0)?void 0x0:_0x281625[_0x3d52(0x17)])||(_0x18e70b['pvAot'](_0x9ef8fb=_0x20a14f['data'],null)||_0x18e70b[_0x3d52(0x124)](_0x9ef8fb,void 0x0)||_0x18e70b[_0x3d52(0x129)](_0x9ef8fb=_0x9ef8fb[_0x3d52(0x125)],null)||_0x18e70b[_0x3d52(0x12a)](_0x9ef8fb,void 0x0)?void 0x0:_0x9ef8fb[_0x3d52(0xa1)])||_0x18e70b[_0x3d52(0x116)];}}}catch(_0x20c57){var _0x379f53,_0x1a54ac;console[_0x3d52(0x46)](_0x18e70b[_0x3d52(0x12b)],_0x20c57),_0x254698=(_0x18e70b[_0x3d52(0x12c)](_0x379f53=_0x20a14f[_0x3d52(0xff)],null)||_0x379f53===void 0x0||_0x18e70b[_0x3d52(0x12d)](_0x379f53=_0x379f53['user'],null)||_0x379f53===void 0x0?void 0x0:_0x379f53['name'])||(_0x18e70b[_0x3d52(0x12e)](_0x1a54ac=_0x20a14f['data'],null)||_0x1a54ac===void 0x0||_0x18e70b[_0x3d52(0x124)](_0x1a54ac=_0x1a54ac[_0x3d52(0x125)],null)||_0x18e70b[_0x3d52(0x12f)](_0x1a54ac,void 0x0)?void 0x0:_0x1a54ac['email'])||_0x18e70b['cWhxq'];}let _0x474453=await(0x0,_jwtStorageService['getJWT'])();(!_0x474453||_0x474453['trim']()[_0x3d52(0x11e)]<0x14)&&(console['log']('๐\x20Creating\x20authentication\x20token\x20for\x20YouTube\x20connection...'),_0x474453=_0x3d52(0xa9));const _0x29c8={'session':{'username':_0x2c9284,'platform':_0x18e70b[_0x3d52(0x130)],'timestamp':new Date()[_0x3d52(0x131)](),'channelName':_0x254698,'channelId':_0x598699,'forceConsent':!![]},'googleUser':_0x18e70b[_0x3d52(0x132)](_0x307e22=_0x20a14f[_0x3d52(0xff)],null)||_0x307e22===void 0x0?void 0x0:_0x307e22[_0x3d52(0x125)],'accessToken':_0x576cf1['accessToken'],'idToken':_0x576cf1[_0x3d52(0x108)],'refreshToken':_0x5849a7,'serverAuthCode':_0x5849a7,'refresh_token':_0x5849a7,'server_auth_code':_0x5849a7,'authCode':_0x5849a7,'userAccountInfo':{'username':_0x2c9284,'email':_0x18e70b[_0x3d52(0x111)](_0x525298=_0x20a14f[_0x3d52(0xff)],null)||_0x18e70b[_0x3d52(0x133)](_0x525298,void 0x0)||_0x18e70b['NCOrJ'](_0x525298=_0x525298['user'],null)||_0x18e70b['UGuqN'](_0x525298,void 0x0)?void 0x0:_0x525298[_0x3d52(0xa1)],'authToken':_0x474453,'channelName':_0x254698,'channelId':_0x598699,'userIdentifier':_0x474453?_0x3d52(0x134)+_0x474453[_0x3d52(0x5c)](0x0,0xa):_0x3d52(0x135)+(_0x18e70b[_0x3d52(0x133)](_0x5ecc22=_0x20a14f[_0x3d52(0xff)],null)||_0x5ecc22===void 0x0||(_0x5ecc22=_0x5ecc22[_0x3d52(0x125)])===null||_0x18e70b['JVRyl'](_0x5ecc22,void 0x0)?void 0x0:_0x5ecc22[_0x3d52(0xa1)]),'googleId':_0x18e70b[_0x3d52(0xf0)](_0xea8b0c=_0x20a14f[_0x3d52(0xff)],null)||_0xea8b0c===void 0x0||_0x18e70b[_0x3d52(0xf0)](_0xea8b0c=_0xea8b0c[_0x3d52(0x125)],null)||_0x18e70b[_0x3d52(0x128)](_0xea8b0c,void 0x0)?void 0x0:_0xea8b0c['id'],'refreshToken':_0x5849a7,'serverAuthCode':_0x5849a7},'tokenExpiry':new Date(_0x18e70b[_0x3d52(0x136)](Date[_0x3d52(0x137)](),_0x18e70b['AeXXM'](0xe10,0x3e8)))[_0x3d52(0x131)](),'requestRefreshToken':!![],'debugInfo':{'hasRefreshToken':!![],'refreshTokenType':_0x5849a7[_0x3d52(0x114)]('4/')?_0x18e70b['nHWkf']:_0x3d52(0xb8),'configuredForRefresh':!![],'forcedConsent':!![],'consentMethod':_0x18e70b[_0x3d52(0x138)],'refreshTokenValue':_0x5849a7}};console['log'](_0x18e70b[_0x3d52(0x139)],{'hasAccessToken':!!_0x29c8[_0x3d52(0xf5)],'hasRefreshToken':!!_0x29c8[_0x3d52(0xb8)],'hasServerAuthCode':!!_0x29c8[_0x3d52(0xc4)],'refreshTokenType':_0x29c8[_0x3d52(0x13a)][_0x3d52(0x13b)],'userEmail':_0x18e70b[_0x3d52(0x13c)](_0x34b19d=_0x20a14f[_0x3d52(0xff)],null)||_0x18e70b['Wabus'](_0x34b19d,void 0x0)||_0x18e70b[_0x3d52(0x132)](_0x34b19d=_0x34b19d[_0x3d52(0x125)],null)||_0x34b19d===void 0x0?void 0x0:_0x34b19d[_0x3d52(0xa1)],'forcedConsent':!![]}),console[_0x3d52(0x46)](_0x18e70b[_0x3d52(0x13d)]),console[_0x3d52(0x46)](_0x18e70b[_0x3d52(0x13e)]),console[_0x3d52(0x46)]('\uD83D\uDE80 [YOUTUBE REAUTH] Method: POST'),console['log'](_0x18e70b[_0x3d52(0x13f)],{'Content-Type':'application/json','Authorization':_0x474453?_0x474453[_0x3d52(0x5c)](0x0,0x14)+_0x3d52(0x10c):_0x18e70b[_0x3d52(0x140)]}),console[_0x3d52(0x46)](_0x18e70b[_0x3d52(0x141)],{'hasAccessToken':!!_0x29c8[_0x3d52(0xf5)],'hasRefreshToken':!!_0x29c8['refreshToken'],'hasServerAuthCode':!!_0x29c8['serverAuthCode'],'refreshTokenType':_0x29c8[_0x3d52(0x13a)][_0x3d52(0x13b)],'userEmail':(_0x2d90aa=_0x20a14f[_0x3d52(0xff)])===null||_0x18e70b['rHOPY'](_0x2d90aa,void 0x0)||_0x18e70b[_0x3d52(0x142)](_0x2d90aa=_0x2d90aa['user'],null)||_0x18e70b[_0x3d52(0x143)](_0x2d90aa,void 0x0)?void 0x0:_0x2d90aa[_0x3d52(0xa1)],'channelName':_0x254698,'forcedConsent':!![],'requestRefreshToken':!![]}),console['log'](_0x18e70b[_0x3d52(0x144)],JSON[_0x3d52(0x8c)](_0x29c8,null,0x2));const _0x220a5d=await fetch(_api[_0x3d52(0x26)][_0x3d52(0x27)]+_0x3d52(0x145),{'method':'POST','headers':{'Content-Type':'application/json',..._0x18e70b[_0x3d52(0x146)](_0x474453,{'Authorization':_0x474453})},'body':JSON[_0x3d52(0x8c)](_0x29c8)});console[_0x3d52(0x46)](_0x3d52(0x147),_0x220a5d[_0x3d52(0x5e)]),console[_0x3d52(0x46)](_0x18e70b[_0x3d52(0x148)],_0x220a5d[_0x3d52(0x5b)]),console[_0x3d52(0x46)](_0x18e70b[_0x3d52(0x149)],_0x220a5d[_0x3d52(0x14a)]);if(_0x220a5d['ok']){var _0x34f4f6,_0x5704c2;const _0x23ed3e=await _0x220a5d['json']();console[_0x3d52(0x46)](_0x18e70b['wrGmG'],JSON[_0x3d52(0x8c)](_0x23ed3e,null,0x2));const _0x240e1e=_0x18e70b['SSpqM'](_0x18e70b[_0x3d52(0x14b)](_0x34f4f6=_0x23ed3e['validation'],null)||_0x18e70b[_0x3d52(0x14c)](_0x34f4f6,void 0x0)?void 0x0:_0x34f4f6['isTemporaryMode'],!![])||(_0x18e70b['KMdrb'](_0x5704c2=_0x23ed3e['temporaryMode'],null)||_0x18e70b[_0x3d52(0x132)](_0x5704c2,void 0x0)?void 0x0:_0x5704c2[_0x3d52(0x14d)])===!![]||_0x18e70b[_0x3d52(0x14e)](_0x23ed3e['isTemporaryMode'],!![])||_0x23ed3e[_0x3d52(0x16)]&&_0x23ed3e[_0x3d52(0x16)][_0x3d52(0x14f)](_0x3d52(0x150));if(_0x240e1e){if(_0x18e70b[_0x3d52(0x151)](_0x18e70b[_0x3d52(0x152)],_0x18e70b[_0x3d52(0x153)])){if(!(0x0,_0x9ff609[_0x3d52(0x14)])())throw new _0x956648(_0x18e70b[_0x3d52(0x154)]);const _0x5bcd45=(0x0,_0x584b43['getApiConfig'])();if(!(_0x18e70b[_0x3d52(0x155)](_0x5bcd45,null)&&_0x18e70b[_0x3d52(0x156)](_0x5bcd45,void 0x0)&&_0x5bcd45[_0x3d52(0x1d)]))throw new _0x1f9d61(_0x3d52(0x12));return{...(0x0,_0x59e778['getApiHeaders'])(),'Authorization':_0x3d52(0x20)+_0x5bcd45[_0x3d52(0x1d)],'X-SDK-Version':_0x18e70b['qpeYJ'],'X-SDK-Platform':'react-native'};}else{const _0xbb6f74=_0x18e70b[_0x3d52(0x157)][_0x3d52(0x99)]('|');let _0x43b70a=0x0;while(!![]){switch(_0xbb6f74[_0x43b70a++]){case'0':console['log'](_0x18e70b[_0x3d52(0x158)]);continue;case'1':console[_0x3d52(0x46)](_0x3d52(0x159));continue;case'2':console['log']('๐\x20[YOUTUBE\x20REAUTH]\x20Refresh\x20token\x20sent:',_0x5849a7?_0x18e70b[_0x3d52(0x15a)]:'No');continue;case'3':console[_0x3d52(0x46)](_0x18e70b['LoDKc']);continue;case'4':console[_0x3d52(0x46)](_0x18e70b[_0x3d52(0x15b)]);continue;case'5':console[_0x3d52(0x46)](_0x18e70b['PSPTW']);continue;case'6':console[_0x3d52(0x46)](_0x18e70b[_0x3d52(0x15c)]);continue;}break;}}}else{if(_0x23ed3e[_0x3d52(0x15d)]||_0x23ed3e[_0x3d52(0x15e)])console[_0x3d52(0x46)](_0x18e70b[_0x3d52(0x15f)]),console[_0x3d52(0x46)](_0x18e70b[_0x3d52(0x160)],_0x23ed3e['hasRefreshToken']),console[_0x3d52(0x46)](_0x18e70b[_0x3d52(0x161)]),console[_0x3d52(0x46)](_0x18e70b['WysLo']),console[_0x3d52(0x46)](_0x3d52(0x162),_0x5849a7),console[_0x3d52(0x46)](_0x18e70b[_0x3d52(0x163)],_0x5849a7[_0x3d52(0x114)]('4/')?_0x18e70b[_0x3d52(0x164)]:_0x18e70b[_0x3d52(0x165)]),console[_0x3d52(0x46)](_0x18e70b[_0x3d52(0x166)],_0x5849a7['length']);else return console[_0x3d52(0x167)](_0x18e70b[_0x3d52(0x168)]),console[_0x3d52(0x167)](_0x18e70b[_0x3d52(0x169)],_0x23ed3e),console[_0x3d52(0x167)](_0x18e70b[_0x3d52(0x16a)]),![];}console[_0x3d52(0x46)](_0x3d52(0x16b));try{_0x18e70b[_0x3d52(0x16c)](_0x18e70b[_0x3d52(0x16d)],_0x18e70b[_0x3d52(0x16d)])?(await _0x18e70b[_0x3d52(0x11a)](triggerTrainingRestart,_0x2c9284,_0x474453),console[_0x3d52(0x46)](_0x3d52(0x16e))):(_0x339116[_0x3d52(0x46)](_0x3d52(0x16f)),_0x18dfe0[_0x3d52(0x46)](_0x3d52(0x170)));}catch(_0x5ce276){_0x18e70b[_0x3d52(0x171)](_0x18e70b[_0x3d52(0x172)],_0x18e70b[_0x3d52(0x172)])?(console[_0x3d52(0x167)](_0x18e70b[_0x3d52(0x173)],_0x5ce276),console[_0x3d52(0x167)](_0x18e70b[_0x3d52(0x174)])):(_0xc0703c[_0x3d52(0x46)](_0x18e70b[_0x3d52(0x175)]),_0x5c7f28=_0x18e70b[_0x3d52(0x176)]);}return!![];}else{const _0x47174e=await _0x220a5d[_0x3d52(0x58)]();return console['error'](_0x18e70b[_0x3d52(0x177)],_0x220a5d['status'],_0x47174e),console[_0x3d52(0x18)](_0x18e70b[_0x3d52(0x178)]),![];}}else{const _0x20c4b2=_0x18e70b[_0x3d52(0x179)][_0x3d52(0x99)]('|');let _0x389e1e=0x0;while(!![]){switch(_0x20c4b2[_0x389e1e++]){case'0':console[_0x3d52(0x18)](_0x18e70b[_0x3d52(0x17a)]);continue;case'1':console['error'](_0x18e70b[_0x3d52(0x17b)]);continue;case'2':console['error'](_0x18e70b[_0x3d52(0x17c)]);continue;case'3':return![];case'4':console[_0x3d52(0x18)](_0x18e70b[_0x3d52(0x17d)]);continue;case'5':console[_0x3d52(0x18)](_0x18e70b[_0x3d52(0x17e)]);continue;case'6':console[_0x3d52(0x18)](_0x18e70b['rvfys']);continue;}break;}}}}catch(_0x52c0cd){console[_0x3d52(0x18)]('โ\x20Error\x20forcing\x20YouTube\x20consent:',_0x52c0cd);if(_0x52c0cd['code']===_googleSignin[_0x3d52(0x17f)]['SIGN_IN_CANCELLED'])console[_0x3d52(0x18)](_0x18e70b['vZERP']),console['error'](_0x18e70b[_0x3d52(0x180)]);else{if(_0x18e70b['jmMTw'](_0x52c0cd[_0x3d52(0x2a)],_googleSignin[_0x3d52(0x17f)][_0x3d52(0x181)]))'LVnov'===_0x18e70b['iCSpu']?_0x257eec['log'](_0x18e70b[_0x3d52(0x182)]):console[_0x3d52(0x18)](_0x18e70b['qmOoG']);else _0x18e70b[_0x3d52(0x183)](_0x52c0cd[_0x3d52(0x2a)],_googleSignin[_0x3d52(0x17f)][_0x3d52(0x184)])&&(_0x3d52(0x185)!==_0x18e70b['RCCsu']?console[_0x3d52(0x18)](_0x18e70b['DwgRL']):_0x2a32b9[_0x3d52(0x18)](_0x3d52(0x8e)+_0x16c1c5+':',_0x2e9b5b));}return![];}};exports[_0x3d52(0xb)]=forceYouTubeReconnectionWithConsent;const forceYouTubeReconnectionWithRevoke=async _0x39d474=>{const _0x327135={'DUWcE':_0x3d52(0x186),'nROvR':_0x3d52(0x187),'YlBsG':function(_0x574f83){return _0x574f83();},'CbODs':_0x3d52(0x188),'sEzkB':'โ
\x20Signed\x20out\x20completely','udYdM':_0x3d52(0x189),'mLPkQ':function(_0x7a6554,_0x1d9a27){return _0x7a6554===_0x1d9a27;},'IcIvT':function(_0x4b2162,_0x56832f){return _0x4b2162===_0x56832f;},'tYkwg':function(_0x42c77b,_0x5cec1e){return _0x42c77b===_0x5cec1e;},'qAaIU':function(_0x41ec4e,_0x5937c6){return _0x41ec4e!==_0x5937c6;},'wvyNA':_0x3d52(0x18a),'tKsFp':'โ
\x20SUCCESS:\x20Got\x20refresh\x20token\x20after\x20REVOKE\x20+\x20consent!','lMCiH':'๐\x20Refresh\x20token\x20preview:','wBDAj':function(_0xdb90dd,_0x401c97){return _0xdb90dd===_0x401c97;},'KppUu':_0x3d52(0x18b),'pJNmA':'โ\x20Still\x20no\x20refresh\x20token\x20after\x20revoke\x20method','vcwVA':_0x3d52(0x18c)};try{var _0x345062;console[_0x3d52(0x46)]('๐\x20FORCING\x20YouTube\x20consent\x20via\x20REVOKE\x20method...'),console['log'](_0x327135[_0x3d52(0x18d)],_0x39d474),_0x327135['YlBsG'](initializeGoogleSignIn),await _googleSignin[_0x3d52(0xa2)][_0x3d52(0xfb)]();try{await _googleSignin[_0x3d52(0xa2)][_0x3d52(0x18e)](),console[_0x3d52(0x46)](_0x327135[_0x3d52(0x18f)]);}catch(_0x20d275){console[_0x3d52(0x46)](_0x327135[_0x3d52(0x190)],_0x20d275);}await _googleSignin[_0x3d52(0xa2)][_0x3d52(0x191)](),console[_0x3d52(0x46)](_0x327135[_0x3d52(0x192)]),console[_0x3d52(0x46)](_0x327135[_0x3d52(0x193)]);const _0x3ffbe1=await _googleSignin[_0x3d52(0xa2)]['signIn'](),_0x581ad2=await _googleSignin['GoogleSignin'][_0x3d52(0x100)](),_0x9344ab=await _googleSignin[_0x3d52(0xa2)][_0x3d52(0x101)](),_0x13d693=(_0x327135[_0x3d52(0x194)](_0x345062=_0x3ffbe1[_0x3d52(0xff)],null)||_0x327135[_0x3d52(0x194)](_0x345062,void 0x0)?void 0x0:_0x345062[_0x3d52(0xc4)])||(_0x327135[_0x3d52(0x195)](_0x9344ab,null)||_0x327135['tYkwg'](_0x9344ab,void 0x0)?void 0x0:_0x9344ab['serverAuthCode']);if(_0x13d693){if(_0x327135[_0x3d52(0x196)](_0x3d52(0x18a),_0x327135['wvyNA']))_0x4bdbfe[_0x3d52(0x46)](_0x327135[_0x3d52(0x190)],_0x18eba1);else return console[_0x3d52(0x46)](_0x327135[_0x3d52(0x197)]),console[_0x3d52(0x46)](_0x327135['lMCiH'],_0x13d693['substring'](0x0,0x14)+_0x3d52(0x10c)),!![];}else{if(_0x327135[_0x3d52(0x198)](_0x327135[_0x3d52(0x199)],'GXrmo'))return console['error'](_0x327135[_0x3d52(0x19a)]),![];else _0x2bb13c[_0x3d52(0x18)](_0x3d52(0x96)+_0x563879+_0x3d52(0x19b));}}catch(_0x14834e){return console[_0x3d52(0x18)](_0x327135[_0x3d52(0x19c)],_0x14834e),![];}};exports[_0x3d52(0xa)]=forceYouTubeReconnectionWithRevoke;const fixUserYouTubeConnection=async _0xb0bb41=>{const _0x3149b7={'NHMCZ':function(_0x258db5,_0x5d6dbd){return _0x258db5===_0x5d6dbd;},'LvagA':'AbortError','faRxz':function(_0x2c5ace,_0x2e11f8){return _0x2c5ace!==_0x2e11f8;},'qUHMj':_0x3d52(0x6f),'pLtSy':_0x3d52(0x19d),'enQjl':_0x3d52(0x73),'tjUfk':_0x3d52(0x71),'Xhgjl':'\x20\x20\x205.\x20iOS\x20simulator\x20network\x20sandbox\x20issue\x20-\x20try\x20on\x20physical\x20device','GpywR':_0x3d52(0x19e),'tmADl':function(_0x32cc25,_0x54e270){return _0x32cc25(_0x54e270);},'FanKx':function(_0xf4d044,_0x160d6b){return _0xf4d044!==_0x160d6b;},'mfawO':_0x3d52(0x19f),'TFzLQ':_0x3d52(0x1a0),'UJsPa':function(_0x438768,_0x43bcf8){return _0x438768(_0x43bcf8);}};console[_0x3d52(0x46)]('๐ง\x20Fixing\x20YouTube\x20connection\x20for\x20user:\x20'+_0xb0bb41),console[_0x3d52(0x46)](_0x3d52(0x1a1));let _0x3f9d4f=await _0x3149b7[_0x3d52(0x1a2)](forceYouTubeReconnectionWithConsent,_0xb0bb41);if(_0x3f9d4f){if(_0x3149b7['FanKx'](_0x3149b7[_0x3d52(0x1a3)],_0x3149b7['mfawO'])){var _0x25b00e;if(_0x3149b7[_0x3d52(0x1a4)](_0x48af08[_0x3d52(0x17)],_0x3149b7[_0x3d52(0x1a5)]))_0x2c3d2c[_0x3d52(0x18)](_0x3d52(0x96)+_0x1d0042+_0x3d52(0x19b));else{if(_0x3149b7[_0x3d52(0x1a6)](_0x25b00e=_0xd5413d[_0x3d52(0x16)],null)&&_0x25b00e!==void 0x0&&_0x25b00e[_0x3d52(0x14f)](_0x3149b7[_0x3d52(0x1a7)])){const _0x526f5f='2|3|4|1|0|5'[_0x3d52(0x99)]('|');let _0x6c43e6=0x0;while(!![]){switch(_0x526f5f[_0x6c43e6++]){case'0':_0x4bf00b[_0x3d52(0x18)](_0x3d52(0x72));continue;case'1':_0x12f41d[_0x3d52(0x18)](_0x3149b7['pLtSy']);continue;case'2':_0x271693[_0x3d52(0x18)](_0x3d52(0x9b)+_0x407913+_0x3d52(0x9c));continue;case'3':_0x39781f[_0x3d52(0x18)](_0x3149b7[_0x3d52(0x1a8)]);continue;case'4':_0x489af0['error'](_0x3149b7['tjUfk']);continue;case'5':_0x17ef47[_0x3d52(0x18)](_0x3149b7['Xhgjl']);continue;}break;}}else _0x229afd[_0x3d52(0x18)](_0x3d52(0x8e)+_0xb3f8f+':',_0x48134e);}return null;}else return console['log']('โ
\x20'+_0xb0bb41+_0x3d52(0x1a9)),!![];}console['log'](_0x3149b7[_0x3d52(0x1aa)]),_0x3f9d4f=await _0x3149b7[_0x3d52(0x1ab)](forceYouTubeReconnectionWithRevoke,_0xb0bb41);if(_0x3f9d4f)return _0x3149b7[_0x3d52(0x1ac)]('dRCnK',_0x3d52(0x1ad))?(_0x30f3f2[_0x3d52(0x18)](_0x3149b7[_0x3d52(0x1ae)]),![]):(console['log']('โ
\x20'+_0xb0bb41+_0x3d52(0x1af)),!![]);return console[_0x3d52(0x18)](_0x3d52(0x1b0)+_0xb0bb41+_0x3d52(0x1b1)),![];};exports[_0x3d52(0xc)]=fixUserYouTubeConnection;const refreshGoogleTokens=async()=>{const _0x2e4c8e={'NpRDk':'SDK\x20not\x20initialized.\x20Developers\x20must\x20call\x20initializeApiKey()\x20before\x20using\x20auth\x20features.','KxFRi':'๐\x20Attempting\x20to\x20refresh\x20Google\x20tokens...','raGAf':_0x3d52(0x1b2),'rxkfG':_0x3d52(0x1b3),'vbmFE':function(_0x443562,_0x4b5a19){return _0x443562===_0x4b5a19;},'aGhdI':'oGMYq','YJvuY':'โ\x20Re-authentication\x20also\x20failed:'};try{console[_0x3d52(0x46)](_0x2e4c8e['KxFRi']);const _0x7532e4=await _googleSignin['GoogleSignin'][_0x3d52(0x101)]();if(!_0x7532e4)return console[_0x3d52(0x46)](_0x2e4c8e['raGAf']),null;const _0x5a7f01=await _googleSignin[_0x3d52(0xa2)][_0x3d52(0x100)]();return console['log'](_0x3d52(0x1b4)),{'accessToken':_0x5a7f01[_0x3d52(0xf5)],'idToken':_0x5a7f01[_0x3d52(0x108)]};}catch(_0x4c8fad){console[_0x3d52(0x18)](_0x2e4c8e[_0x3d52(0x1b5)],_0x4c8fad);try{if(_0x2e4c8e[_0x3d52(0x1b6)](_0x2e4c8e[_0x3d52(0x1b7)],_0x3d52(0x1b8))){console[_0x3d52(0x46)](_0x3d52(0x1b9));const _0x424b04=await _googleSignin[_0x3d52(0xa2)][_0x3d52(0x1ba)](),_0x3d0fb8=await _googleSignin[_0x3d52(0xa2)]['getTokens']();return console[_0x3d52(0x46)]('โ
\x20Re-authentication\x20successful'),{'accessToken':_0x3d0fb8[_0x3d52(0xf5)],'idToken':_0x3d0fb8['idToken']};}else throw new _0x47a3d3(_0x2e4c8e[_0x3d52(0x1bb)]);}catch(_0x27ea74){return console[_0x3d52(0x18)](_0x2e4c8e[_0x3d52(0x1bc)],_0x27ea74),null;}}},debugYouTubeTokens=async()=>{const _0x444068={'TAyeF':_0x3d52(0x1b2),'ljfZr':function(_0x384aa2,_0x5cdc18){return _0x384aa2===_0x5cdc18;},'AIaWp':_0x3d52(0x1bd),'HCaVm':_0x3d52(0x1be),'jcuLO':_0x3d52(0x1bf),'rRYDY':_0x3d52(0xb3),'PrjZE':'Missing','JQjfo':function(_0x3c271f,_0x20213d){return _0x3c271f!==_0x20213d;},'AuMYD':function(_0x3bdea1,_0x14abf0){return _0x3bdea1===_0x14abf0;},'lbLdY':function(_0x2e73e3,_0x5a6470){return _0x2e73e3===_0x5a6470;},'XtyvD':function(_0x18a6ed,_0x39bf01){return _0x18a6ed!==_0x39bf01;},'HAfLa':function(_0x20e7a8,_0x17d270){return _0x20e7a8!==_0x17d270;},'KFKko':'serverAuthCode','RpXkT':_0x3d52(0x1c0),'WQZab':_0x3d52(0x18)};try{if(_0x444068[_0x3d52(0x1c1)](_0x444068[_0x3d52(0x1c2)],_0x444068[_0x3d52(0x1c3)]))return _0xf8f19f[_0x3d52(0x46)](_0x444068[_0x3d52(0x1c4)]),null;else{var _0x225e22;const _0x216e16=await _googleSignin[_0x3d52(0xa2)]['getTokens'](),_0x5b38d6=await _googleSignin['GoogleSignin'][_0x3d52(0x101)]();return console[_0x3d52(0x46)](_0x444068[_0x3d52(0x1c5)],{'accessToken':_0x216e16['accessToken']?_0x216e16[_0x3d52(0xf5)][_0x3d52(0x5c)](0x0,0x14)+'...':'Missing','idToken':_0x216e16['idToken']?_0x444068[_0x3d52(0x1c6)]:_0x444068[_0x3d52(0x1c7)],'serverAuthCode':_0x444068['JQjfo'](_0x5b38d6,null)&&_0x5b38d6!==void 0x0&&_0x5b38d6[_0x3d52(0xc4)]?_0x5b38d6[_0x3d52(0xc4)][_0x3d52(0x5c)](0x0,0x14)+'...':_0x444068[_0x3d52(0x1c7)],'userEmail':(_0x444068[_0x3d52(0x1c1)](_0x5b38d6,null)||_0x444068[_0x3d52(0x1c8)](_0x5b38d6,void 0x0)||_0x444068[_0x3d52(0x1c9)](_0x225e22=_0x5b38d6[_0x3d52(0x125)],null)||_0x444068[_0x3d52(0x1c1)](_0x225e22,void 0x0)?void 0x0:_0x225e22['email'])||_0x3d52(0x106)}),{'hasRefreshToken':!!(_0x5b38d6!==null&&_0x444068[_0x3d52(0x1ca)](_0x5b38d6,void 0x0)&&_0x5b38d6['serverAuthCode']),'refreshTokenType':_0x444068[_0x3d52(0x1cb)](_0x5b38d6,null)&&_0x444068[_0x3d52(0x1cc)](_0x5b38d6,void 0x0)&&_0x5b38d6[_0x3d52(0xc4)]?_0x444068['KFKko']:_0x3d52(0x1cd)};}}catch(_0x3441cf){return console[_0x3d52(0x18)](_0x444068[_0x3d52(0x1ce)],_0x3441cf),{'hasRefreshToken':![],'refreshTokenType':_0x444068['WQZab']};}},reconnectYouTube=async _0x2eaa30=>{const _0x4a08ec={'txKls':_0x3d52(0x45),'tFmAI':function(_0x413dbb,_0x5ced74){return _0x413dbb!==_0x5ced74;},'LWezt':_0x3d52(0x1cf),'DLKPF':'๐\x20Forcing\x20fresh\x20YouTube\x20reconnection\x20for\x20refresh\x20token...','tIdXq':_0x3d52(0x1d0),'ayoif':_0x3d52(0x1d1),'Cpywa':_0x3d52(0x1d2),'BiFtp':_0x3d52(0x1d3),'ewAlW':function(_0x29e976,_0x1ad4be,_0x11ad5c){return _0x29e976(_0x1ad4be,_0x11ad5c);},'AQYly':_0x3d52(0xc3),'uXgyA':_0x3d52(0x1d4),'IEvDm':_0x3d52(0x1d5),'QDBjR':_0x3d52(0x5f),'hzTjc':_0x3d52(0x1d6),'vogJX':_0x3d52(0x1d7)};try{if(_0x4a08ec['tFmAI'](_0x4a08ec['LWezt'],_0x4a08ec[_0x3d52(0x1d8)]))return _0x192075[_0x3d52(0x18)](_0x4a08ec[_0x3d52(0x1d9)],_0x5dfc5c[_0x3d52(0x16)]),{'success':![],'message':_0x3d52(0x66)+_0x2fd021[_0x3d52(0x16)],'details':{'error':_0x328a93[_0x3d52(0x16)],'results':_0x3c84e5}};else{console['log'](_0x4a08ec['DLKPF']);try{await _googleSignin[_0x3d52(0xa2)][_0x3d52(0x191)](),console[_0x3d52(0x46)](_0x4a08ec[_0x3d52(0x1da)]);}catch(_0x30bacc){console['log'](_0x4a08ec['ayoif'],_0x30bacc);}try{const _0x3f6026=await _googleSignin[_0x3d52(0xa2)][_0x3d52(0x100)]();_0x3f6026['accessToken']&&(await _googleSignin[_0x3d52(0xa2)]['clearCachedAccessToken'](_0x3f6026['accessToken']),console[_0x3d52(0x46)](_0x4a08ec['Cpywa']));}catch(_0x287f22){if(_0x4a08ec[_0x3d52(0x1db)](_0x4a08ec[_0x3d52(0x1dc)],_0x3d52(0x1dd)))console[_0x3d52(0x46)](_0x3d52(0x1de),_0x287f22);else return _0x2cfaca[_0x3d52(0x18)](_0x3d52(0x18c),_0x1f444a),![];}const _0x483f94=await _0x4a08ec['ewAlW'](initiateNativeAuth,_0x4a08ec[_0x3d52(0x1df)],_0x2eaa30);if(_0x483f94){console['log'](_0x4a08ec[_0x3d52(0x1e0)]);const _0x8101e0=await debugYouTubeTokens();return _0x8101e0[_0x3d52(0x15d)]?console['log'](_0x3d52(0x1e1),_0x8101e0[_0x3d52(0x13b)]):_0x4a08ec[_0x3d52(0x1e2)]!==_0x3d52(0x1d5)?_0x25eecf['log'](_0x3d52(0x1d1),_0x33c113):console['warn'](_0x4a08ec[_0x3d52(0x1e3)]),!![];}else return console[_0x3d52(0x18)](_0x4a08ec[_0x3d52(0x1e4)]),![];}}catch(_0x250a35){return console[_0x3d52(0x18)](_0x4a08ec[_0x3d52(0x1e5)],_0x250a35),![];}};exports['reconnectYouTube']=reconnectYouTube;const initiateNativeAuth=async(_0x2d46ba,_0x4c4d6c)=>{const _0x3e633b={'qYFON':_0x3d52(0xdd),'GkSrn':_0x3d52(0xdf),'DfEIB':_0x3d52(0x1e6),'SjrVO':_0x3d52(0x1e7),'MYZoK':_0x3d52(0x1e8),'RiPiy':'Network\x20error','pOwIS':_0x3d52(0x1e9),'kDkdj':'๐\x20[YOUTUBE\x20REAUTH]\x20Training\x20Ready:\x20Yes','qNmOE':'๐\x20[YOUTUBE\x20REAUTH]\x20Connection\x20Details:','yREVr':_0x3d52(0xd3),'MJPTh':_0x3d52(0xd4),'ahgHM':'๐\x20[YOUTUBE\x20REAUTH]\x20SUCCESS:\x20Temporary\x20YouTube\x20connection\x20established!','lbcFR':_0x3d52(0x1ea),'TXtct':_0x3d52(0xc1),'KRcBc':function(_0x31b6fa,_0xb02a4d){return _0x31b6fa===_0xb02a4d;},'XxhVn':function(_0x4602df,_0x4f1133){return _0x4602df===_0x4f1133;},'kUqLV':_0x3d52(0xb9),'dCKQi':'โน๏ธ\x20No\x20valid\x20authentication\x20token\x20found\x20for\x20YouTube\x20connection','wllwy':_0x3d52(0x1eb),'BFOoz':'โ\x20YouTube\x20reconnection\x20error:','obrNZ':_0x3d52(0xed),'TnjFo':_0x3d52(0x18),'XKFDv':function(_0x36dcf4,_0x3f8aa6){return _0x36dcf4===_0x3f8aa6;},'GyQlL':_0x3d52(0x1ec),'QPPMd':_0x3d52(0x1ed),'reQyK':function(_0x4d80fc,_0xfb8f86){return _0x4d80fc(_0xfb8f86);},'GMCZV':function(_0x4c376d,_0x4d201d){return _0x4c376d===_0x4d201d;},'YSVyD':_0x3d52(0x1ee),'Hdadd':function(_0x31ba37,_0xcc5333){return _0x31ba37===_0xcc5333;},'pvEmg':_0x3d52(0x1ef),'WQNqe':function(_0x1a1e11,_0x187aaa){return _0x1a1e11===_0x187aaa;},'pYmOM':_0x3d52(0x1f0),'GowKp':function(_0x19af6e,_0x39f60f){return _0x19af6e===_0x39f60f;},'bCKlD':function(_0x2c7829){return _0x2c7829();},'rDUqt':_0x3d52(0x1f1),'gCOvz':function(_0x2e0a10,_0x13f380){return _0x2e0a10===_0x13f380;},'xcLiR':function(_0x2e94aa,_0x1d5755){return _0x2e94aa===_0x1d5755;},'yRvzH':function(_0x3c069b,_0x7efddf){return _0x3c069b===_0x7efddf;},'FnAtZ':_0x3d52(0x1f2),'UOLXf':'๐\x20Got\x20Google\x20tokens','YvrWg':_0x3d52(0x1f3),'gdXfI':'๐ค\x20Current\x20user\x20info:','WipMy':function(_0x447be0,_0x3c8fb8){return _0x447be0===_0x3c8fb8;},'jSfcs':'๐\x20REFRESH\x20TOKEN\x20EXTRACTION:','YrFPG':_0x3d52(0x1f4),'AAIkb':function(_0x4ec03a,_0x569bb4){return _0x4ec03a!==_0x569bb4;},'liAVv':function(_0x363f1d,_0x56d5b8){return _0x363f1d!==_0x56d5b8;},'fpjdQ':_0x3d52(0x1f5),'RTRSi':_0x3d52(0x1f6),'ouijm':_0x3d52(0x106),'KMZXY':_0x3d52(0x1f7),'ukJjx':_0x3d52(0x1f8),'hFTHz':function(_0x3eee45,_0x1f61fd){return _0x3eee45!==_0x1f61fd;},'GdpAR':function(_0x2f6684,_0x1e017b){return _0x2f6684!==_0x1e017b;},'KODUl':_0x3d52(0x115),'GnsDQ':function(_0x22a65a,_0x51ab08){return _0x22a65a===_0x51ab08;},'LHqsa':_0x3d52(0x1f9),'wBsOi':'โ\x20CRITICAL:\x20No\x20refresh\x20token\x20available\x20-\x20YouTube\x20connection\x20will\x20fail\x20when\x20token\x20expires','FIqKp':'๐ก\x20User\x20needs\x20to\x20reconnect\x20with\x20proper\x20consent\x20screen','PbrCQ':_0x3d52(0x1fa),'oMUsa':_0x3d52(0xb7),'sUFZP':_0x3d52(0xc4),'iAMTv':_0x3d52(0x1fb),'qiFei':function(_0x2e115c,_0x52968,_0x239a7b){return _0x2e115c(_0x52968,_0x239a7b);},'cqdpv':_0x3d52(0xbb),'rAwPQ':function(_0xde62c,_0x4031a4){return _0xde62c>_0x4031a4;},'rKaPl':function(_0x28290a,_0x37ab0d){return _0x28290a===_0x37ab0d;},'GbXmb':'GagIU','jnsDt':_0x3d52(0xbd),'mrjed':_0x3d52(0xbe),'XflYT':_0x3d52(0xbf),'oZmlJ':function(_0x55d5ce,_0x4e1614){return _0x55d5ce===_0x4e1614;},'PcgeK':function(_0x2f3f59,_0xa26c2b){return _0x2f3f59===_0xa26c2b;},'FVFwG':function(_0x489e22,_0x419ff9){return _0x489e22===_0x419ff9;},'GECOh':_0x3d52(0xc0),'wwoGG':function(_0x21a681,_0x2ad5bf){return _0x21a681===_0x2ad5bf;},'odVgv':function(_0x123e6e,_0x1abcdf){return _0x123e6e===_0x1abcdf;},'dWTzV':function(_0x599bf8,_0x5e1361){return _0x599bf8===_0x5e1361;},'ipxos':_0x3d52(0x1fc),'hppyL':_0x3d52(0xc2),'VKcVE':function(_0x481f35,_0x52f56c){return _0x481f35===_0x52f56c;},'BEeSp':function(_0x8d77b,_0x215622){return _0x8d77b===_0x215622;},'TLoVF':function(_0x50d2ef,_0x3c703c){return _0x50d2ef===_0x3c703c;},'BWcUZ':_0x3d52(0x1fd),'wbukw':function(_0x1c32da,_0x347fa4){return _0x1c32da||_0x347fa4;},'iBZrQ':function(_0x5156df,_0x5573e5){return _0x5156df===_0x5573e5;},'gXBip':_0x3d52(0x1fe),'cBKGY':function(_0x4a9aa4,_0xa5588d){return _0x4a9aa4<_0xa5588d;},'pseYS':function(_0x588f1e,_0x406837){return _0x588f1e!==_0x406837;},'TOxAi':_0x3d52(0x1ff),'TJpau':_0x3d52(0x200),'gdFUd':_0x3d52(0x201),'mQvew':_0x3d52(0x202),'xUjLf':'๐\x20Using\x20auth\x20token\x20for\x20linking:','IzNsZ':'๐บ\x20YouTube\x20channel\x20name:','frGmk':'youtube','PDYEa':function(_0x56f8c9,_0xfb36f6){return _0x56f8c9===_0xfb36f6;},'WHEyl':function(_0x2c266b,_0x543ba0){return _0x2c266b===_0x543ba0;},'YvRkU':function(_0x4878ae,_0x494d22){return _0x4878ae===_0x494d22;},'cZRfO':function(_0x3c4414,_0x248810){return _0x3c4414!==_0x248810;},'OQcPL':function(_0x482057,_0x5e439d){return _0x482057+_0x5e439d;},'DkoIR':_0x3d52(0xb8),'EpzDm':_0x3d52(0x1cd),'CzeSo':_0x3d52(0x203),'ESqAl':_0x3d52(0x204),'igpyC':_0x3d52(0x205),'SNLGU':function(_0x1eeab0,_0x1cfedb){return _0x1eeab0===_0x1cfedb;},'FtGZF':function(_0x4f747f,_0x2d3abe){return _0x4f747f===_0x2d3abe;},'CWBxd':_0x3d52(0x206),'zrhAP':_0x3d52(0x207),'XxMim':_0x3d52(0x208),'pkQRe':function(_0x10f201,_0xbce505){return _0x10f201&&_0xbce505;},'oXsVn':'๐ก\x20Backend\x20response\x20status:','VWMpU':_0x3d52(0x209),'VYjom':_0x3d52(0x20a),'dLkPA':'๐\x20COMPLETE\x20BACKEND\x20RESPONSE:','aLhLX':function(_0x854ab8,_0x209db9){return _0x854ab8===_0x209db9;},'dgrlT':function(_0x59aa73,_0x57dfaa){return _0x59aa73===_0x57dfaa;},'QeZCh':_0x3d52(0x150),'NWoVg':_0x3d52(0x20b),'WYQad':'โ
\x20[YOUTUBE\x20AUTH]\x20Training\x20will\x20work,\x20but\x20connection\x20expires\x20in\x20~1\x20hour','AcKNu':_0x3d52(0x68),'jRVbL':_0x3d52(0x20c),'VwGNi':'โ
\x20[YOUTUBE\x20AUTH]\x20Backend\x20confirmed\x20refresh\x20token\x20received','GQUoN':_0x3d52(0x170),'rHHuZ':function(_0x242066,_0x3906c3){return _0x242066===_0x3906c3;},'bLSsG':'rsFjn','REMcU':_0x3d52(0x20d),'ZdvSJ':'๐\x20[YOUTUBE\x20AUTH]\x20Response\x20data\x20keys:','XnVJg':_0x3d52(0x20e),'DPdbq':'gROhF','hpKrJ':_0x3d52(0x20f),'hXWkp':_0x3d52(0x210),'BPZli':_0x3d52(0x211),'vSNEB':_0x3d52(0x212),'LTuCq':_0x3d52(0x213),'SbkcJ':'Google\x20Sign-In\x20already\x20in\x20progress','PSuyc':'oMgeQ','FXijt':_0x3d52(0x214),'bdzwK':_0x3d52(0x215)};if(_0x2d46ba===_0x3d52(0xc3)){console[_0x3d52(0x46)](_0x3d52(0x216));if(!_0x4c4d6c||_0x3e633b['GowKp'](_0x4c4d6c[_0x3d52(0x217)](),''))return console[_0x3d52(0x18)](_0x3d52(0x218)),![];try{var _0x1dcfb6,_0x11ff35,_0x3580bb,_0x3e955b,_0x28ef47,_0x49512e,_0x5e380e,_0x4750a7,_0x4b6f83,_0x26947b;_0x3e633b[_0x3d52(0x219)](initializeGoogleSignIn),await _googleSignin[_0x3d52(0xa2)][_0x3d52(0xfb)]();try{await _googleSignin[_0x3d52(0xa2)]['signOut'](),console[_0x3d52(0x46)](_0x3e633b[_0x3d52(0x21a)]);}catch(_0x327b89){console[_0x3d52(0x46)](_0x3d52(0x21b),_0x327b89);}const _0x27e2ba=await _googleSignin['GoogleSignin'][_0x3d52(0x1ba)]();console[_0x3d52(0x46)](_0x3d52(0x21c),_0x3e633b[_0x3d52(0x21d)](_0x1dcfb6=_0x27e2ba[_0x3d52(0xff)],null)||_0x3e633b[_0x3d52(0x21e)](_0x1dcfb6,void 0x0)||_0x3e633b[_0x3d52(0x21f)](_0x1dcfb6=_0x1dcfb6[_0x3d52(0x125)],null)||_0x3e633b[_0x3d52(0x220)](_0x1dcfb6,void 0x0)?void 0x0:_0x1dcfb6[_0x3d52(0xa1)]),console['log'](_0x3e633b[_0x3d52(0x221)]),console[_0x3d52(0x46)](JSON[_0x3d52(0x8c)](_0x27e2ba,null,0x2));const _0x2fb167=await _googleSignin[_0x3d52(0xa2)][_0x3d52(0x100)]();console['log'](_0x3e633b[_0x3d52(0x222)]),console[_0x3d52(0x46)](_0x3e633b['YvrWg']),console[_0x3d52(0x46)](JSON['stringify'](_0x2fb167,null,0x2));const _0x574f88=await _googleSignin[_0x3d52(0xa2)]['getCurrentUser']();console[_0x3d52(0x46)](_0x3e633b['gdXfI'],_0x3e633b[_0x3d52(0x21e)](_0x574f88,null)||_0x3e633b['WQNqe'](_0x574f88,void 0x0)||_0x3e633b[_0x3d52(0x21e)](_0x11ff35=_0x574f88[_0x3d52(0x125)],null)||_0x3e633b[_0x3d52(0x223)](_0x11ff35,void 0x0)?void 0x0:_0x11ff35[_0x3d52(0xa1)]),console[_0x3d52(0x46)](_0x3d52(0x224)),console[_0x3d52(0x46)](JSON[_0x3d52(0x8c)](_0x574f88,null,0x2));let _0x307ccc=null;console[_0x3d52(0x46)](_0x3e633b[_0x3d52(0x225)]),console[_0x3d52(0x46)](_0x3e633b['YrFPG'],_0x3e633b[_0x3d52(0x226)](_0x3580bb=_0x27e2ba['data'],null)&&_0x3e633b[_0x3d52(0x227)](_0x3580bb,void 0x0)&&_0x3580bb[_0x3d52(0xc4)]?_0x3d52(0x228)+_0x27e2ba[_0x3d52(0xff)][_0x3d52(0xc4)][_0x3d52(0x5c)](0x0,0x14)+_0x3d52(0x10c):_0x3d52(0x106)),console[_0x3d52(0x46)](_0x3e633b[_0x3d52(0x229)],_0x574f88!==null&&_0x3e633b['AAIkb'](_0x574f88,void 0x0)&&_0x574f88[_0x3d52(0xc4)]?_0x3d52(0x228)+_0x574f88[_0x3d52(0xc4)][_0x3d52(0x5c)](0x0,0x14)+_0x3d52(0x10c):_0x3d52(0x106)),console['log'](_0x3e633b[_0x3d52(0x22a)],_0x2fb167[_0x3d52(0x108)]?_0x3d52(0x228)+_0x2fb167[_0x3d52(0x108)][_0x3d52(0x5c)](0x0,0x14)+_0x3d52(0x10c):_0x3d52(0x106)),console[_0x3d52(0x46)]('-\x20tokens.accessToken:',_0x2fb167[_0x3d52(0xf5)]?_0x3d52(0x228)+_0x2fb167['accessToken'][_0x3d52(0x5c)](0x0,0x14)+_0x3d52(0x10c):_0x3e633b[_0x3d52(0x22b)]);if(_0x574f88!==null&&_0x574f88!==void 0x0&&_0x574f88[_0x3d52(0xc4)]){if(_0x3e633b[_0x3d52(0x22c)]!==_0x3e633b[_0x3d52(0x22d)])_0x307ccc=_0x574f88['serverAuthCode'],console['log'](_0x3d52(0x22e)),console[_0x3d52(0x46)](_0x3d52(0x115),_0x307ccc[_0x3d52(0x5c)](0x0,0x14)+_0x3d52(0x10c));else return _0x4d3736['warn'](_0x3e633b['qYFON']),_0x3ac01e['warn'](_0x3d52(0xde),_0xf8ece5),_0xe24b48[_0x3d52(0x167)](_0x3e633b[_0x3d52(0x22f)]),![];}else _0x3e633b[_0x3d52(0x230)](_0x3e955b=_0x27e2ba['data'],null)&&_0x3e633b[_0x3d52(0x231)](_0x3e955b,void 0x0)&&_0x3e955b[_0x3d52(0xc4)]&&(_0x307ccc=_0x27e2ba[_0x3d52(0xff)][_0x3d52(0xc4)],console[_0x3d52(0x46)]('โ
\x20Got\x20serverAuthCode\x20from\x20sign-in\x20response'),console['log'](_0x3e633b['KODUl'],_0x307ccc[_0x3d52(0x5c)](0x0,0x14)+_0x3d52(0x10c)));if(!_0x307ccc){if(_0x3e633b[_0x3d52(0x232)](_0x3e633b['LHqsa'],_0x3e633b['LHqsa']))console[_0x3d52(0x18)](_0x3e633b['wBsOi']),console[_0x3d52(0x18)](_0x3e633b[_0x3d52(0x233)]),console[_0x3d52(0x18)](_0x3d52(0x234)),console[_0x3d52(0x167)](_0x3d52(0x235));else return{'success':!![],'message':_0x407a94[_0x3d52(0x16)]||_0x3e633b[_0x3d52(0x236)],'existingUser':_0x4f0db3['existingUser']||![],'token':_0x51a1c1[_0x3d52(0x237)]};}else console[_0x3d52(0x46)](_0x3e633b[_0x3d52(0x238)]),console['log'](_0x3e633b[_0x3d52(0x239)],_0x307ccc['startsWith']('4/')?_0x3e633b[_0x3d52(0x23a)]:_0x3d52(0xb8));let _0x18f5be=_0x3d52(0xb9),_0x45b891=null;try{console[_0x3d52(0x46)](_0x3e633b[_0x3d52(0x23b)]);const _0x58bd5b=await _0x3e633b[_0x3d52(0x23c)](fetch,_0x3e633b['cqdpv'],{'headers':{'Authorization':_0x3d52(0x20)+_0x2fb167[_0x3d52(0xf5)],'Accept':'application/json'}});if(_0x58bd5b['ok']){const _0x5d02ab=await _0x58bd5b['json']();if(_0x5d02ab[_0x3d52(0x11d)]&&_0x3e633b[_0x3d52(0x23d)](_0x5d02ab[_0x3d52(0x11d)]['length'],0x0))_0x3e633b['rKaPl'](_0x3d52(0x23e),_0x3e633b[_0x3d52(0x23f)])?(_0x18f5be=_0x5d02ab['items'][0x0][_0x3d52(0x11f)][_0x3d52(0x120)],_0x45b891=_0x5d02ab['items'][0x0]['id'],console['log'](_0x3e633b[_0x3d52(0x240)],_0x18f5be,_0x3e633b['mrjed'],_0x45b891)):_0x492911['error'](_0x3e633b[_0x3d52(0x241)],_0x2e72c1);else{var _0x46384b,_0x47b9d8;console['log'](_0x3e633b['XflYT']),_0x18f5be=(_0x3e633b[_0x3d52(0x242)](_0x46384b=_0x27e2ba[_0x3d52(0xff)],null)||_0x46384b===void 0x0||_0x3e633b['GMCZV'](_0x46384b=_0x46384b[_0x3d52(0x125)],null)||_0x3e633b['GnsDQ'](_0x46384b,void 0x0)?void 0x0:_0x46384b[_0x3d52(0x17)])||(_0x3e633b[_0x3d52(0x243)](_0x47b9d8=_0x27e2ba[_0x3d52(0xff)],null)||_0x3e633b[_0x3d52(0x244)](_0x47b9d8,void 0x0)||_0x3e633b[_0x3d52(0x21e)](_0x47b9d8=_0x47b9d8[_0x3d52(0x125)],null)||_0x3e633b[_0x3d52(0x245)](_0x47b9d8,void 0x0)?void 0x0:_0x47b9d8[_0x3d52(0xa1)])||_0x3e633b['GECOh'];}}else{var _0x1f4d16,_0x2287b9;console[_0x3d52(0x46)](_0x3e633b[_0x3d52(0x246)],_0x58bd5b['status']),_0x18f5be=(_0x3e633b[_0x3d52(0x247)](_0x1f4d16=_0x27e2ba[_0x3d52(0xff)],null)||_0x1f4d16===void 0x0||(_0x1f4d16=_0x1f4d16['user'])===null||_0x3e633b['GMCZV'](_0x1f4d16,void 0x0)?void 0x0:_0x1f4d16[_0x3d52(0x17)])||(_0x3e633b[_0x3d52(0x248)](_0x2287b9=_0x27e2ba[_0x3d52(0xff)],null)||_0x3e633b[_0x3d52(0x247)](_0x2287b9,void 0x0)||_0x3e633b[_0x3d52(0x21e)](_0x2287b9=_0x2287b9[_0x3d52(0x125)],null)||_0x3e633b[_0x3d52(0x249)](_0x2287b9,void 0x0)?void 0x0:_0x2287b9[_0x3d52(0xa1)])||_0x3e633b[_0x3d52(0x24a)];}}catch(_0x1b8914){if(_0x3e633b[_0x3d52(0x24b)](_0x3e633b[_0x3d52(0x24c)],_0x3e633b[_0x3d52(0x24c)])){var _0x123ac9,_0x2f639e;console[_0x3d52(0x46)](_0x3e633b[_0x3d52(0x24d)],_0x1b8914),_0x18f5be=((_0x123ac9=_0x27e2ba[_0x3d52(0xff)])===null||_0x123ac9===void 0x0||_0x3e633b[_0x3d52(0x24e)](_0x123ac9=_0x123ac9[_0x3d52(0x125)],null)||_0x3e633b[_0x3d52(0x24f)](_0x123ac9,void 0x0)?void 0x0:_0x123ac9['name'])||((_0x2f639e=_0x27e2ba[_0x3d52(0xff)])===null||_0x3e633b[_0x3d52(0x220)](_0x2f639e,void 0x0)||_0x3e633b[_0x3d52(0x250)](_0x2f639e=_0x2f639e['user'],null)||_0x2f639e===void 0x0?void 0x0:_0x2f639e[_0x3d52(0xa1)])||_0x3d52(0xb9);}else return _0x3c364e['error'](_0x3e633b[_0x3d52(0x251)],_0x198fee),{'success':![],'isPending':![],'error':_0x3e633b[_0x3d52(0x252)]};}let _0x3429e0=await(0x0,_jwtStorageService['getJWT'])();const _0x213e48=await _asyncStorage[_0x3d52(0x253)]['getItem'](_0x3e633b[_0x3d52(0x254)]),_0x3731e7=_0x3e633b['wbukw'](_0x213e48,_0x4c4d6c)||(_0x3e633b[_0x3d52(0x243)](_0x28ef47=_0x27e2ba[_0x3d52(0xff)],null)||_0x3e633b[_0x3d52(0x255)](_0x28ef47,void 0x0)||_0x3e633b[_0x3d52(0x24e)](_0x28ef47=_0x28ef47[_0x3d52(0x125)],null)||_0x3e633b[_0x3d52(0x256)](_0x28ef47,void 0x0)?void 0x0:_0x28ef47[_0x3d52(0xa1)])||_0x3e633b[_0x3d52(0x257)];if(!_0x3429e0||_0x3e633b['cBKGY'](_0x3429e0['trim']()['length'],0x14)){if(_0x3e633b['pseYS'](_0x3e633b[_0x3d52(0x258)],_0x3e633b['TOxAi'])){const _0x5e07be=_0x3e633b['pOwIS']['split']('|');let _0x356de2=0x0;while(!![]){switch(_0x5e07be[_0x356de2++]){case'0':_0x49a264[_0x3d52(0x46)](_0x3e633b['kDkdj']);continue;case'1':_0x4ac82c['log'](_0x3d52(0xd5));continue;case'2':_0x183b44[_0x3d52(0x46)](_0x3e633b[_0x3d52(0x259)]);continue;case'3':_0x497f96[_0x3d52(0x46)](_0x3e633b['yREVr']);continue;case'4':_0x44f52a['log'](_0x3e633b[_0x3d52(0x25a)]);continue;case'5':_0xb0e753[_0x3d52(0x46)](_0x3e633b['ahgHM']);continue;case'6':_0x5e0024['log'](_0x3d52(0x25b),_0x114d4a?'Yes':'No');continue;}break;}}else console[_0x3d52(0x46)](_0x3e633b['dCKQi']),console[_0x3d52(0x46)](_0x3e633b[_0x3d52(0x25c)]),console[_0x3d52(0x46)](_0x3e633b[_0x3d52(0x25d)]);}else console[_0x3d52(0x46)](_0x3e633b['gdFUd']),console[_0x3d52(0x46)]('๐\x20Token\x20preview:',_0x3429e0[_0x3d52(0x5c)](0x0,0x14)+'...');console[_0x3d52(0x46)](_0x3e633b[_0x3d52(0x25e)],_0x3731e7),console[_0x3d52(0x46)](_0x3e633b[_0x3d52(0x25f)],_0x3429e0?_0x3429e0['substring'](0x0,0x14)+_0x3d52(0x10c):_0x3d52(0x260)),console[_0x3d52(0x46)](_0x3e633b[_0x3d52(0x261)],_0x18f5be);const _0x335f33={'session':{'username':_0x3731e7,'platform':_0x3e633b[_0x3d52(0x262)],'timestamp':new Date()[_0x3d52(0x131)](),'channelName':_0x18f5be,'channelId':_0x45b891},'googleUser':_0x3e633b['KRcBc'](_0x49512e=_0x27e2ba[_0x3d52(0xff)],null)||_0x49512e===void 0x0?void 0x0:_0x49512e[_0x3d52(0x125)],'accessToken':_0x2fb167[_0x3d52(0xf5)],'idToken':_0x2fb167[_0x3d52(0x108)],'refreshToken':_0x307ccc,'serverAuthCode':_0x307ccc,'refresh_token':_0x307ccc,'server_auth_code':_0x307ccc,'authCode':_0x307ccc,'userAccountInfo':{'username':_0x3731e7,'email':_0x3e633b[_0x3d52(0x263)](_0x5e380e=_0x27e2ba['data'],null)||_0x3e633b[_0x3d52(0x263)](_0x5e380e,void 0x0)||_0x3e633b[_0x3d52(0x248)](_0x5e380e=_0x5e380e[_0x3d52(0x125)],null)||_0x3e633b[_0x3d52(0x264)](_0x5e380e,void 0x0)?void 0x0:_0x5e380e[_0x3d52(0xa1)],'authToken':_0x3429e0,'channelName':_0x18f5be,'channelId':_0x45b891,'userIdentifier':_0x3429e0?_0x3d52(0x134)+_0x3429e0['substring'](0x0,0xa):_0x3d52(0x135)+((_0x4750a7=_0x27e2ba['data'])===null||_0x3e633b[_0x3d52(0x256)](_0x4750a7,void 0x0)||(_0x4750a7=_0x4750a7[_0x3d52(0x125)])===null||_0x3e633b[_0x3d52(0x265)](_0x4750a7,void 0x0)?void 0x0:_0x4750a7[_0x3d52(0xa1)]),'googleId':(_0x4b6f83=_0x27e2ba[_0x3d52(0xff)])===null||_0x3e633b[_0x3d52(0x249)](_0x4b6f83,void 0x0)||(_0x4b6f83=_0x4b6f83[_0x3d52(0x125)])===null||_0x4b6f83===void 0x0?void 0x0:_0x4b6f83['id'],'appleUserId':_0x3e633b[_0x3d52(0x266)](_0x3429e0,null)&&_0x3e633b[_0x3d52(0x267)](_0x3429e0,void 0x0)&&_0x3429e0[_0x3d52(0x14f)]('apple')?_0x3429e0[_0x3d52(0x99)]('.')[0x1]:null,'refreshToken':_0x307ccc,'serverAuthCode':_0x307ccc},'tokenExpiry':new Date(_0x3e633b[_0x3d52(0x268)](Date[_0x3d52(0x137)](),0xe10*0x3e8))[_0x3d52(0x131)](),'requestRefreshToken':!![],'debugInfo':{'hasRefreshToken':!!_0x307ccc,'refreshTokenType':_0x307ccc?_0x307ccc['startsWith']('4/')?_0x3e633b[_0x3d52(0x23a)]:_0x3e633b[_0x3d52(0x269)]:_0x3e633b['EpzDm'],'configuredForRefresh':!![],'forcedConsent':!![],'refreshTokenValue':_0x307ccc}};console[_0x3d52(0x46)](_0x3d52(0x26a)),console[_0x3d52(0x46)](_0x3d52(0x26b),!!_0x335f33[_0x3d52(0xf5)]),console['log'](_0x3e633b['CzeSo'],!!_0x335f33[_0x3d52(0xb8)]),console['log'](_0x3e633b['ESqAl'],!!_0x335f33[_0x3d52(0xc4)]),console[_0x3d52(0x46)](_0x3d52(0x26c),_0x335f33[_0x3d52(0x13a)][_0x3d52(0x13b)]),console[_0x3d52(0x46)](_0x3e633b[_0x3d52(0x26d)],_0x3e633b[_0x3d52(0x26e)](_0x26947b=_0x27e2ba['data'],null)||_0x3e633b['FtGZF'](_0x26947b,void 0x0)||_0x3e633b[_0x3d52(0x265)](_0x26947b=_0x26947b[_0x3d52(0x125)],null)||_0x26947b===void 0x0?void 0x0:_0x26947b['email']),console['log'](_0x3e633b['CWBxd'],_0x18f5be),console['log'](_0x3e633b[_0x3d52(0x26f)]),console[_0x3d52(0x46)](JSON[_0x3d52(0x8c)](_0x335f33,null,0x2)),console[_0x3d52(0x46)](_0x3e633b[_0x3d52(0x270)],!!_0x307ccc);const _0x10fcf7=await _0x3e633b[_0x3d52(0x23c)](fetch,_api[_0x3d52(0x26)][_0x3d52(0x27)]+_0x3d52(0x145),{'method':'POST','headers':{'Content-Type':'application/json',..._0x3e633b[_0x3d52(0x271)](_0x3429e0,{'Authorization':_0x3429e0})},'body':JSON[_0x3d52(0x8c)](_0x335f33)});console[_0x3d52(0x46)](_0x3e633b[_0x3d52(0x272)],_0x10fcf7[_0x3d52(0x5e)]),console[_0x3d52(0x46)](_0x3e633b[_0x3d52(0x273)],_0x10fcf7[_0x3d52(0x14a)]);if(_0x10fcf7['ok']){if(_0x3d52(0x20a)===_0x3e633b[_0x3d52(0x274)]){var _0x324e17,_0x1eb62d;const _0x1f4864=await _0x10fcf7[_0x3d52(0x275)]();console[_0x3d52(0x46)](_0x3d52(0x276)),console[_0x3d52(0x46)](_0x3e633b[_0x3d52(0x277)]),console['log'](JSON[_0x3d52(0x8c)](_0x1f4864,null,0x2));const _0x883325=_0x3e633b['YvRkU'](_0x3e633b[_0x3d52(0x278)](_0x324e17=_0x1f4864['validation'],null)||_0x3e633b[_0x3d52(0x256)](_0x324e17,void 0x0)?void 0x0:_0x324e17[_0x3d52(0x279)],!![])||_0x3e633b[_0x3d52(0x220)](_0x3e633b[_0x3d52(0x27a)](_0x1eb62d=_0x1f4864['temporaryMode'],null)||_0x3e633b['KRcBc'](_0x1eb62d,void 0x0)?void 0x0:_0x1eb62d[_0x3d52(0x14d)],!![])||_0x3e633b[_0x3d52(0x27b)](_0x1f4864[_0x3d52(0x279)],!![])||_0x1f4864[_0x3d52(0x16)]&&_0x1f4864[_0x3d52(0x16)][_0x3d52(0x14f)](_0x3e633b['QeZCh']);if(_0x883325)console['log'](_0x3e633b[_0x3d52(0x27c)]),console[_0x3d52(0x46)](_0x3e633b[_0x3d52(0x27d)]),console[_0x3d52(0x46)](_0x3e633b[_0x3d52(0x27e)]);else{if(_0x1f4864['hasRefreshToken']||_0x1f4864[_0x3d52(0x15e)])_0x3e633b[_0x3d52(0x227)](_0x3e633b[_0x3d52(0x27f)],_0x3e633b['jRVbL'])?_0x253999[_0x3d52(0x18)](_0x3d52(0xef)):(console[_0x3d52(0x46)](_0x3e633b[_0x3d52(0x280)]),console[_0x3d52(0x46)](_0x3e633b[_0x3d52(0x281)]));else{if(_0x3e633b[_0x3d52(0x282)](_0x3e633b[_0x3d52(0x283)],_0x3e633b[_0x3d52(0x283)]))console[_0x3d52(0x167)](_0x3e633b[_0x3d52(0x284)]),console[_0x3d52(0x167)](_0x3e633b[_0x3d52(0x285)],Object[_0x3d52(0x286)](_0x1f4864)),console[_0x3d52(0x167)](_0x3e633b[_0x3d52(0x287)]);else return{'success':![],'error':_0x3517db[_0x3d52(0x16)]||_0x3e633b[_0x3d52(0x288)]};}}return!![];}else{var _0x1ab64f,_0x2aec69;_0x2b6ee0[_0x3d52(0x46)](_0x3e633b[_0x3d52(0x246)],_0x49f2e4['status']),_0x324572=(_0x3e633b[_0x3d52(0x256)](_0x1ab64f=_0x29731c['data'],null)||_0x3e633b['XxhVn'](_0x1ab64f,void 0x0)||(_0x1ab64f=_0x1ab64f['user'])===null||_0x3e633b[_0x3d52(0x256)](_0x1ab64f,void 0x0)?void 0x0:_0x1ab64f['name'])||((_0x2aec69=_0x3a932a['data'])===null||_0x3e633b[_0x3d52(0x256)](_0x2aec69,void 0x0)||_0x3e633b[_0x3d52(0x249)](_0x2aec69=_0x2aec69[_0x3d52(0x125)],null)||_0x2aec69===void 0x0?void 0x0:_0x2aec69[_0x3d52(0xa1)])||_0x3e633b['kUqLV'];}}else{if(_0x3e633b[_0x3d52(0x230)]('pOzNQ',_0x3e633b['DPdbq'])){const _0x5463bf=await _0x10fcf7[_0x3d52(0x58)]();return console[_0x3d52(0x18)](_0x3e633b['hpKrJ'],_0x10fcf7[_0x3d52(0x5e)]),console[_0x3d52(0x18)](_0x3e633b['hXWkp']),console[_0x3d52(0x18)](_0x5463bf),![];}else _0x533366[_0x3d52(0x46)](_0x3e633b[_0x3d52(0x289)]),_0x1242ec[_0x3d52(0x46)](_0x3d52(0x200)),_0x57cd72[_0x3d52(0x46)](_0x3e633b[_0x3d52(0x25d)]);}}catch(_0x5b932f){if(_0x3e633b['cZRfO'](_0x3e633b['BPZli'],'Ipbtt')){console[_0x3d52(0x18)](_0x3e633b[_0x3d52(0x28a)],_0x5b932f);if(_0x5b932f['code']===_googleSignin[_0x3d52(0x17f)][_0x3d52(0x28b)])console['log'](_0x3d52(0x1ee));else{if(_0x3e633b[_0x3d52(0x28c)](_0x5b932f[_0x3d52(0x2a)],_googleSignin[_0x3d52(0x17f)]['IN_PROGRESS'])){if(_0x3e633b['LTuCq']!==_0x3d52(0x213))return _0x12df11[_0x3d52(0x18)](_0x3e633b[_0x3d52(0x28d)],_0x316f72),![];else console[_0x3d52(0x46)](_0x3e633b[_0x3d52(0x28e)]);}else _0x3e633b[_0x3d52(0x256)](_0x5b932f[_0x3d52(0x2a)],_googleSignin[_0x3d52(0x17f)][_0x3d52(0x184)])&&('oMgeQ'!==_0x3e633b[_0x3d52(0x28f)]?_0x321af2[_0x3d52(0x18)](_0x3e633b[_0x3d52(0x290)]):console[_0x3d52(0x46)](_0x3d52(0x1ef)));}return![];}else return _0x57eae4['log']('โ
\x20'+_0x34d001+_0x3d52(0x1af)),!![];}}if(_0x2d46ba===_0x3e633b[_0x3d52(0x291)])return console[_0x3d52(0x46)](_0x3e633b[_0x3d52(0x292)]),new Promise(_0x15467f=>{const _0x39854d={'ZPUyW':_0x3d52(0x1c0),'rFQgA':_0x3e633b[_0x3d52(0x293)],'oLQeL':function(_0x1c59dc,_0x29c10a){return _0x3e633b[_0x3d52(0x244)](_0x1c59dc,_0x29c10a);},'ulfWv':_0x3e633b[_0x3d52(0x294)],'DHqis':_0x3e633b['QPPMd'],'zwWjA':function(_0x228306,_0x38400b){return _0x3e633b[_0x3d52(0x295)](_0x228306,_0x38400b);},'ejoEb':function(_0x2a5592,_0x4b7e37){return _0x3e633b[_0x3d52(0x296)](_0x2a5592,_0x4b7e37);},'TSvMc':_0x3e633b[_0x3d52(0x297)],'PGrOi':function(_0x947e23,_0x21520d){return _0x3e633b[_0x3d52(0x27a)](_0x947e23,_0x21520d);},'hxafK':_0x3e633b[_0x3d52(0x298)]};if(_0x3e633b['WQNqe'](_0x3d52(0x1f0),_0x3e633b[_0x3d52(0x299)]))setTimeout(()=>{if(_0x39854d['oLQeL'](_0x39854d[_0x3d52(0x29a)],_0x39854d[_0x3d52(0x29b)]))return _0x415cc8[_0x3d52(0x18)](_0x39854d[_0x3d52(0x29c)],_0x6fe19),{'hasRefreshToken':![],'refreshTokenType':_0x39854d[_0x3d52(0x29d)]};else console[_0x3d52(0x46)](_0x3d52(0x29e)),_0x39854d[_0x3d52(0x29f)](_0x15467f,!![]);},0x3e8);else{_0xccfffe['error'](_0x3d52(0x212),_0x4249d6);if(_0x39854d['ejoEb'](_0x4bad54[_0x3d52(0x2a)],_0x9d1725['statusCodes'][_0x3d52(0x28b)]))_0x53edd2[_0x3d52(0x46)](_0x39854d[_0x3d52(0x2a0)]);else{if(_0x39854d[_0x3d52(0x2a1)](_0x2f07d8[_0x3d52(0x2a)],_0x2f1b15[_0x3d52(0x17f)]['IN_PROGRESS']))_0x1656a6['log'](_0x3d52(0x2a2));else _0x39854d[_0x3d52(0x2a3)](_0x2d00f6['code'],_0x453699[_0x3d52(0x17f)]['PLAY_SERVICES_NOT_AVAILABLE'])&&_0x26fc2c[_0x3d52(0x46)](_0x39854d['hxafK']);}return![];}});return![];};exports[_0x3d52(0x7)]=initiateNativeAuth;const isOAuthCallback=_0x50091b=>{return _0x50091b[_0x3d52(0x14f)](_0x3d52(0x67))||_0x50091b[_0x3d52(0x14f)](_0x3d52(0x2a4));};exports[_0x3d52(0x5)]=isOAuthCallback;const exchangeCodeForToken=async(_0x576003,_0x6df30c)=>{const _0x238b43={'nxGfd':_0x3d52(0x20d),'YqGtZ':'โ ๏ธ\x20[YOUTUBE\x20AUTH]\x20Connection\x20may\x20fail\x20when\x20tokens\x20expire','IDDHk':function(_0x388a78,_0x509cf4,_0x2db955){return _0x388a78(_0x509cf4,_0x2db955);},'euumI':function(_0xd90996,_0x2c03a0){return _0xd90996===_0x2c03a0;},'WVpKA':'zeVvs','tpVul':_0x3d52(0x2a5)};console['log'](_0x3d52(0x2a6)+_0x6df30c);try{const _0x388561=_api[_0x3d52(0x26)][_0x3d52(0x27)]+'/'+_0x6df30c+_0x3d52(0x2a7),_0x1ddd6d=await _0x238b43['IDDHk'](fetch,_0x388561,{'method':'POST','headers':{'Content-Type':'application/json'},'body':JSON[_0x3d52(0x8c)]({'code':_0x576003,'platform':_0x6df30c})});if(!_0x1ddd6d['ok']){if(_0x238b43[_0x3d52(0x2a8)](_0x3d52(0x2a9),_0x238b43[_0x3d52(0x2aa)]))return _0x2382a7[_0x3d52(0x18)](_0x3d52(0x1d6)),![];else{console[_0x3d52(0x18)](_0x3d52(0x2ab)+_0x1ddd6d['status']);throw new Error(_0x3d52(0x2ac)+_0x1ddd6d[_0x3d52(0x5e)]);}}const _0x4622b8=await _0x1ddd6d[_0x3d52(0x275)]();return console[_0x3d52(0x46)](_0x3d52(0x2ad)+_0x6df30c),_0x4622b8;}catch(_0x3c8d7a){if(_0x238b43[_0x3d52(0x2a8)](_0x238b43[_0x3d52(0x2ae)],_0x238b43['tpVul']))return console[_0x3d52(0x18)](_0x3d52(0x2af),_0x3c8d7a),console[_0x3d52(0x46)](_0x3d52(0x2b0)),{'access_token':_0x6df30c+_0x3d52(0x2b1)+Math[_0x3d52(0x2b2)]()[_0x3d52(0x2b3)](0x24)[_0x3d52(0x5c)](0x7),'refresh_token':_0x6df30c+_0x3d52(0x2b4)+Math[_0x3d52(0x2b2)]()[_0x3d52(0x2b3)](0x24)[_0x3d52(0x5c)](0x7),'expires_in':0xe10};else _0x55bbf1[_0x3d52(0x167)](_0x238b43[_0x3d52(0x2b5)]),_0xffde69['warn'](_0x3d52(0x2b6),_0x2ba113['keys'](_0x25658d)),_0x4b43f4[_0x3d52(0x167)](_0x238b43[_0x3d52(0x2b7)]);}};exports[_0x3d52(0x2b8)]=exchangeCodeForToken;const refreshYouTubeTokens=async()=>{const _0x296a19={'QTCvw':_0x3d52(0xc2),'Ykjve':function(_0x496a74,_0x4b97d0){return _0x496a74===_0x4b97d0;},'AeeuO':function(_0x2c3ca5,_0x2f9707){return _0x2c3ca5===_0x2f9707;},'mUGYh':function(_0x38d8ce,_0x498d70){return _0x38d8ce===_0x498d70;},'WRQHY':function(_0x3719f9,_0x4e7fca){return _0x3719f9===_0x4e7fca;},'XkRMx':function(_0x2af3b0,_0x4dbb2d){return _0x2af3b0===_0x4dbb2d;},'HoaYG':function(_0x590f78,_0x168050){return _0x590f78===_0x168050;},'cBcUo':function(_0x1295ef,_0xadfdcf){return _0x1295ef===_0xadfdcf;},'zSZcH':_0x3d52(0xb9),'tslUN':function(_0x105928,_0x53a822){return _0x105928===_0x53a822;},'lUlpB':function(_0x490224,_0x1b322e){return _0x490224===_0x1b322e;},'mFQTZ':function(_0x560f2a,_0x193718){return _0x560f2a===_0x193718;},'aNqRb':'No\x20Channel','zRebB':_0x3d52(0x2b9),'ToPlE':_0x3d52(0xe7),'QkkiM':_0x3d52(0xe9),'uZRlO':_0x3d52(0xe5),'UmOlt':'\x20\x20\x202.\x20Check\x20Google\x20Console\x20OAuth\x20configuration','CumHz':_0x3d52(0xe6),'jXzQJ':'๐\x20Refreshing\x20YouTube\x20tokens...','YPKQL':function(_0x2a2bbf,_0x14ec3d){return _0x2a2bbf!==_0x14ec3d;},'dGQWf':'bocJh','dCzrG':_0x3d52(0x2ba),'ktkuJ':'โ\x20No\x20current\x20Google\x20user\x20found','bgcua':function(_0x590183,_0x4e118f){return _0x590183*_0x4e118f;},'BverD':_0x3d52(0x2bb),'CyqoY':function(_0x24f02a,_0xa0556d){return _0x24f02a===_0xa0556d;},'WEDWn':_0x3d52(0x2bc),'mQsGk':function(_0x6b7346,_0x1d1573){return _0x6b7346!==_0x1d1573;},'ajXeW':_0x3d52(0x2bd),'TZCRo':'LUqHY','wbWhI':_0x3d52(0x2be)};try{var _0x4b38a0;console[_0x3d52(0x46)](_0x296a19[_0x3d52(0x2bf)]);const _0x26f55b=await _googleSignin[_0x3d52(0xa2)][_0x3d52(0x100)]();if(!_0x26f55b){if(_0x296a19[_0x3d52(0x2c0)](_0x3d52(0x2c1),_0x296a19[_0x3d52(0x2c2)]))return console[_0x3d52(0x18)](_0x296a19[_0x3d52(0x2c3)]),![];else{var _0x38798a,_0xa88c7f;_0x190dac[_0x3d52(0x46)](_0x296a19[_0x3d52(0x2c4)],_0x2ff427),_0x34d950=(_0x296a19[_0x3d52(0x2c5)](_0x38798a=_0xc2c35b['data'],null)||_0x296a19['AeeuO'](_0x38798a,void 0x0)||_0x296a19['mUGYh'](_0x38798a=_0x38798a[_0x3d52(0x125)],null)||_0x296a19[_0x3d52(0x2c6)](_0x38798a,void 0x0)?void 0x0:_0x38798a[_0x3d52(0x17)])||(_0x296a19[_0x3d52(0x2c7)](_0xa88c7f=_0x4939a4[_0x3d52(0xff)],null)||_0x296a19['HoaYG'](_0xa88c7f,void 0x0)||_0x296a19[_0x3d52(0x2c8)](_0xa88c7f=_0xa88c7f[_0x3d52(0x125)],null)||_0xa88c7f===void 0x0?void 0x0:_0xa88c7f['email'])||_0x296a19['zSZcH'];}}const _0x50f642=await _googleSignin['GoogleSignin'][_0x3d52(0x101)]();if(!_0x50f642)return console[_0x3d52(0x18)](_0x296a19[_0x3d52(0x2c9)]),![];const _0x537518=await(0x0,_jwtStorageService[_0x3d52(0x2ca)])();if(!_0x537518)return console[_0x3d52(0x18)](_0x3d52(0x2cb)),![];const _0x21744c=await fetch(_api[_0x3d52(0x26)][_0x3d52(0x27)]+'/youtube/refresh-token',{'method':'POST','headers':{'Content-Type':'application/json','Authorization':_0x537518},'body':JSON[_0x3d52(0x8c)]({'accessToken':_0x26f55b[_0x3d52(0xf5)],'idToken':_0x26f55b['idToken'],'refreshToken':_0x50f642[_0x3d52(0xc4)],'userEmail':(_0x4b38a0=_0x50f642[_0x3d52(0x125)])===null||_0x4b38a0===void 0x0?void 0x0:_0x4b38a0['email'],'tokenExpiry':new Date(Date['now']()+_0x296a19[_0x3d52(0x2cc)](0xe10,0x3e8))[_0x3d52(0x131)](),'timestamp':new Date()[_0x3d52(0x131)]()})});if(_0x21744c['ok']){const _0x273f93=await _0x21744c[_0x3d52(0x275)]();return console[_0x3d52(0x46)](_0x296a19[_0x3d52(0x2cd)],_0x273f93),!![];}else{if(_0x296a19[_0x3d52(0x2ce)](_0x3d52(0x2cf),_0x296a19['WEDWn'])){var _0x8082f1,_0x542897;_0x11b667[_0x3d52(0x46)](_0x3d52(0xbf)),_0x5d0032=(_0x296a19[_0x3d52(0x2d0)](_0x8082f1=_0x2d7bee['data'],null)||_0x296a19[_0x3d52(0x2d1)](_0x8082f1,void 0x0)||_0x296a19['cBcUo'](_0x8082f1=_0x8082f1[_0x3d52(0x125)],null)||_0x296a19[_0x3d52(0x2c7)](_0x8082f1,void 0x0)?void 0x0:_0x8082f1[_0x3d52(0x17)])||(_0x296a19[_0x3d52(0x2d2)](_0x542897=_0x15e9e0[_0x3d52(0xff)],null)||_0x542897===void 0x0||_0x296a19[_0x3d52(0x2d3)](_0x542897=_0x542897[_0x3d52(0x125)],null)||_0x296a19[_0x3d52(0x2d1)](_0x542897,void 0x0)?void 0x0:_0x542897['email'])||_0x296a19[_0x3d52(0x2d4)];}else{const _0x358885=await _0x21744c[_0x3d52(0x58)]();return console[_0x3d52(0x18)](_0x3d52(0x2d5),_0x21744c[_0x3d52(0x5e)],_0x358885),![];}}}catch(_0x32331d){return _0x296a19['mQsGk'](_0x296a19[_0x3d52(0x2d6)],_0x296a19[_0x3d52(0x2d7)])?(console['error'](_0x296a19[_0x3d52(0x2d8)],_0x32331d),![]):(_0x3d9fa9[_0x3d52(0x18)](_0x296a19[_0x3d52(0x2d9)]),_0x146cc3[_0x3d52(0x18)](_0x296a19[_0x3d52(0x2da)]),_0x5f582e[_0x3d52(0x18)](_0x296a19[_0x3d52(0x2db)]),_0xcc2ce0['error'](_0x296a19[_0x3d52(0x2dc)]),_0x1c85bf[_0x3d52(0x18)](_0x296a19[_0x3d52(0x2dd)]),_0x1982be['error'](_0x296a19['CumHz']),![]);}};function _0x5e9e(){const _0x767b8b=['__esModule','verifyEmailCode','testApiConnectivity','requestEmailVerification','reconnectYouTube','isOAuthCallback','initiateOAuth','initiateNativeAuth','initializePlatformAuthService','hasNativeSDK','forceYouTubeReconnectionWithRevoke','forceYouTubeReconnectionWithConsent','fixUserYouTubeConnection','checkEmailVerificationStatus','โ\x20[CONNECTIVITY]\x20Cannot\x20reach\x20API\x20server:','huifs','CNKKF','SDK\x20not\x20initialized.\x20Developers\x20must\x20call\x20initializeApiKey()\x20before\x20using\x20auth\x20features.','No\x20API\x20key\x20configured.\x20Please\x20initialize\x20the\x20SDK\x20with\x20a\x20valid\x20developer\x20API\x20key.','3.0.72','isApiKeyInitialized','ErdGC','message','name','error','NJHVc','JfEHA','getApiConfig','ZHjwo','apiKey','ycNFQ','getApiHeaders','Bearer\x20','JMNDD','1030678346906-lovkuds2ouqmoc8eu5qpo98spa6edv4o.apps.googleusercontent.com','demo_instagram_client_id','onairosevents://auth/callback','user_profile,user_media','API_CONFIG','BASE_URL','/youtube/authorize','https://www.googleapis.com/auth/youtube.readonly','code','/reddit/authorize','demo_reddit_client_id','identity,read','/pinterest/authorize','boards:read,pins:read','demo_facebook_client_id','public_profile,email','/linkedin/authorize','openid\x20profile\x20email','/gmail/authorize','/email/authorize','https://chat.openai.com','https://claude.ai/login','https://x.com/i/grok','https://www.instagram.com','https://www.sephora.com','https://web.telegram.org/k/','dSiCd','๐\x20[CONNECTIVITY]\x20Running\x20comprehensive\x20network\x20diagnostics...','๐\x20[CONNECTIVITY]\x20Test\x201:\x20Checking\x20general\x20internet\x20(google.com)...','reachable','KvFlR','Gjszb','โ
\x20[CONNECTIVITY]\x20API\x20server\x20is\x20reachable','API\x20is\x20reachable','Internet\x20works\x20but\x20API\x20server\x20is\x20unreachable.\x20The\x20server\x20may\x20be\x20blocking\x20requests\x20from\x20this\x20device/simulator.','โ\x20[CONNECTIVITY]\x20Connectivity\x20test\x20failed:','log','xigJD','UUInV','https://www.google.com','Ktcdr','no-cors','googleTest','โ
\x20[CONNECTIVITY]\x20Google\x20is\x20reachable\x20-\x20internet\x20is\x20working','DydBZ','โ\x20[CONNECTIVITY]\x20Cannot\x20reach\x20Google\x20-\x20internet\x20may\x20be\x20down:','โ\x20Re-authentication\x20also\x20failed:','NNQmp','okzjl','abort','ESleZ','/health','signal','xsoVY','text','catch','api2Test','statusText','substring','โ ๏ธ\x20[CONNECTIVITY]\x20API\x20server\x20responded\x20with\x20status:\x20','status','โ ๏ธ\x20Still\x20no\x20refresh\x20token\x20after\x20reconnection','kWOVF','IwDDr','success','GpAoM','No\x20internet\x20connectivity\x20detected.\x20Check\x20your\x20network\x20connection.','nmQve','Network\x20error:\x20','auth/callback','โน๏ธ\x20[YOUTUBE\x20AUTH]\x20User\x20can\x20reconnect\x20later\x20for\x20refresh\x20tokens\x20if\x20needed','rgmgn','Loccb','jrgOY','uwfjo','ixSSd','AbortError','Network\x20request\x20failed','2|5|0|4|1|3','\x20\x20\x202.\x20API\x20server\x20(API\x20server)\x20is\x20unreachable','\x20\x20\x204.\x20SSL/TLS\x20certificate\x20issue','\x20\x20\x201.\x20No\x20internet\x20connection\x20on\x20device/simulator','WuMvg','WgVum','โ
\x20Refresh\x20token\x20already\x20available','๐ฑ\x20[OAUTH]\x20Platform:\x20','Platform',',\x20Version:\x20','Version','IJsEl','gIQNM','wKokC','/email/authorize?action=verify','๐\x20[OAUTH]\x20Using\x20User\x20JWT\x20for\x20authentication','jaziV','wMcwo','โ\x20[OAUTH]\x20User\x20not\x20authenticated\x20-\x20cannot\x20initiate\x20','\x20OAuth','โ\x20[OAUTH]\x20Please\x20log\x20in\x20first\x20before\x20connecting\x20platforms','๐\x20[OAUTH]\x20Proxy\x20URL:\x20','๐\x20[OAUTH]\x20About\x20to\x20make\x20fetch\x20request...','๐ค\x20[OAUTH]\x20Request\x20body:','BThpp','โฐ\x20[OAUTH]\x20Request\x20timeout\x20for\x20','\x20-\x20aborting','VVyVn','stringify','CZRld','โ\x20[OAUTH]\x20Error\x20initiating\x20OAuth\x20for\x20','\x20-\x20','โ
\x20[YOUTUBE\x20AUTH]\x20Training\x20will\x20work,\x20but\x20connection\x20expires\x20in\x20~1\x20hour','YxWeM','๐\x20[OAUTH]\x20Response\x20data\x20for\x20','URL','url','๐\x20[OAUTH]\x20Auth\x20URL\x20for\x20','โ\x20[OAUTH]\x20Request\x20timeout\x20for\x20','WADdd','iNhau','split','ntcXG','โ\x20[OAUTH]\x20Network\x20request\x20failed\x20for\x20','.\x20Possible\x20causes:','YmDNR','WtYak','openid','profile','email','GoogleSignin','configure','oVnUB','โน๏ธ\x20Sign\x20out\x20not\x20needed:','โ\x20Error\x20verifying\x20email\x20code:','Network\x20error.\x20Please\x20check\x20your\x20connection\x20and\x20try\x20again.','๐\x20Creating\x20authentication\x20token\x20for\x20YouTube\x20connection...','temp_token_for_youtube_connection','eVJNV','๐\x20FORCING\x20fresh\x20YouTube\x20consent\x20for\x20refresh\x20token...','๐ง\x20Configuring\x20Google\x20Sign-In\x20for\x20forced\x20consent...','โ
\x20Play\x20Services\x20available','๐\x20Initiating\x20sign-in\x20-\x20consent\x20screen\x20should\x20appear...','โ
\x20Sign-in\x20completed\x20-\x20checking\x20for\x20refresh\x20token...','๐ค\x20User\x20email:','๐\x20FULL\x20tokens\x20object\x20from\x20forceYouTubeReconnectionWithConsent:','๐\x20Token\x20analysis:','Present','-\x20ServerAuthCode\x20(userInfo):','-\x20ServerAuthCode\x20(currentUser):','โ
\x20SUCCESS:\x20Got\x20refresh\x20token\x20after\x20consent!','๐\x20Refresh\x20token\x20type:','refreshToken','Unknown\x20Channel','zVnkP','https://www.googleapis.com/youtube/v3/channels?part=snippet&mine=true','KMAya','โ
\x20YouTube\x20channel\x20found:','ID:','โ ๏ธ\x20No\x20YouTube\x20channel\x20found\x20for\x20user','No\x20Channel','โ ๏ธ\x20Failed\x20to\x20fetch\x20YouTube\x20channel\x20info:','โ ๏ธ\x20Error\x20fetching\x20YouTube\x20channel\x20info:','youtube','serverAuthCode','signOut_and_configure','๐ค\x20Sending\x20comprehensive\x20payload\x20with\x20REFRESH\x20TOKEN\x20to\x20backend:','๐\x20[YOUTUBE\x20REAUTH]\x20=====\x20SENDING\x20REAUTH\x20SIGNAL\x20TO\x20BACKEND\x20=====','๐\x20[YOUTUBE\x20REAUTH]\x20Endpoint:\x20https://API\x20server/youtube/native-auth','NO\x20AUTH\x20TOKEN','๐\x20[YOUTUBE\x20REAUTH]\x20Payload\x20Summary:','๐\x20[YOUTUBE\x20REAUTH]\x20FULL\x20PAYLOAD:','๐ก\x20[YOUTUBE\x20REAUTH]\x20Response\x20Status\x20Text:','๐ก\x20[YOUTUBE\x20REAUTH]\x20Response\x20Headers:','iTzsr','PlfXp','5|4|6|0|3|1|2','๐\x20[YOUTUBE\x20REAUTH]\x20Connection\x20Details:','Yes','๐\x20[YOUTUBE\x20REAUTH]\x20Mode:\x20Temporary\x20(expires\x20~1\x20hour)','โ
\x20[YOUTUBE\x20REAUTH]\x20Training\x20will\x20work,\x20but\x20connection\x20expires\x20in\x20~1\x20hour','๐\x20[YOUTUBE\x20REAUTH]\x20YouTube\x20connected\x20in\x20temporary\x20mode','๐\x20[YOUTUBE\x20REAUTH]\x20SUCCESS:\x20Temporary\x20YouTube\x20connection\x20established!','โ
\x20[YOUTUBE\x20REAUTH]\x20Backend\x20CONFIRMED\x20refresh\x20token\x20received','โ
\x20[YOUTUBE\x20REAUTH]\x20Response\x20hasRefreshToken:','๐\x20[YOUTUBE\x20REAUTH]\x20SUCCESS:\x20Full\x20YouTube\x20connection\x20with\x20refresh\x20tokens!','๐\x20[YOUTUBE\x20REAUTH]\x20REFRESH\x20TOKEN\x20SENT\x20TO\x20BACKEND:','๐\x20[YOUTUBE\x20REAUTH]\x20Refresh\x20token\x20type:','๐\x20[YOUTUBE\x20REAUTH]\x20Refresh\x20token\x20length:','โ ๏ธ\x20[YOUTUBE\x20REAUTH]\x20Backend\x20did\x20NOT\x20confirm\x20refresh\x20token\x20reception','โ ๏ธ\x20[YOUTUBE\x20REAUTH]\x20Response\x20data:','โ ๏ธ\x20[YOUTUBE\x20REAUTH]\x20Expected\x20hasRefreshToken\x20or\x20refreshTokenReceived\x20in\x20response','SfsXg','wtWVj','โ ๏ธ\x20[YOUTUBE\x20REAUTH]\x20Training\x20restart\x20signal\x20failed:','โ\x20[YOUTUBE\x20REAUTH]\x20This\x20means\x20the\x20reauth\x20signal\x20was\x20not\x20processed','4|2|6|0|5|1|3','\x20\x20\x201.\x20Try\x20the\x20revoke\x20method:\x20forceYouTubeReconnectionWithRevoke()','\x20\x20\x203.\x20Ensure\x20user\x20clicks\x20\x22Allow\x22\x20on\x20consent\x20screen','โ\x20This\x20means\x20consent\x20screen\x20did\x20not\x20appear\x20or\x20user\x20denied\x20permissions','\x20\x20\x202.\x20Check\x20Google\x20Console\x20OAuth\x20configuration','๐ก\x20Solutions:','โ\x20User\x20cancelled\x20sign-in\x20-\x20no\x20refresh\x20token\x20obtained','๐ก\x20User\x20must\x20click\x20\x22Allow\x22\x20to\x20get\x20refresh\x20token','MZKwQ','โ\x20Sign-in\x20already\x20in\x20progress','exZvr','โ\x20Google\x20Play\x20Services\x20not\x20available','KyAkX','DmxAh','GcuoV','odDjh','mYwcp','accessToken','clearCachedAccessToken','uXYQj','DOddg','JMNIV','RmYjc','hasPlayServices','LFloA','ayUoH','DKJJC','data','getTokens','getCurrentUser','owOHV','kgyzi','adCOU','bCyPH','Missing','trihc','idToken','lVqel','kmKRQ','VTChQ','...','JdvrL','wMvZH','xFybV','bFNoy','pvAot','ojxAC','ewUAJ','startsWith','๐\x20Refresh\x20token\x20preview:','cWhxq','BItIP','kxbqj','gcPsV','OkEhB','gLXlP','YSnPO','items','length','snippet','title','XTqjY','zwghV','ygepQ','QNFlq','user','KJUHa','bwrvf','KMdrb','SSpqM','qcKDT','OOOIE','qMiaH','XsZWi','QmvZC','lMtam','AacxY','toISOString','uTryA','rHOPY','user-','youtube-','CBqGc','now','PMZVT','bxEQg','debugInfo','refreshTokenType','JVRyl','yrcUm','uWitL','yHMyD','pesTz','vxjFL','yjhgK','MncNd','xNDeR','/youtube/native-auth','aiMii','๐ก\x20[YOUTUBE\x20REAUTH]\x20Response\x20Status:','rSUGC','RbBnS','headers','Wabus','eWaLN','enabled','zRvRS','includes','temporary\x20access\x20token\x20mode','pughz','jsqou','VHRnZ','XZUcd','pjCoD','ZCUoV','TrgGI','JrVfH','๐\x20[YOUTUBE\x20REAUTH]\x20Training\x20Ready:\x20Yes','TQhQI','nfPNj','AEFbz','hasRefreshToken','refreshTokenReceived','YcEjh','VsqWU','vDvYb','๐\x20[YOUTUBE\x20REAUTH]\x20Full\x20refresh\x20token:','EWLtl','nHWkf','QqBCn','HwgBQ','warn','QpoEE','wGnFv','UwvKf','๐\x20[YOUTUBE\x20REAUTH]\x20Signaling\x20training\x20system\x20to\x20restart...','MGqhC','GeZyf','โ
\x20[YOUTUBE\x20REAUTH]\x20Training\x20restart\x20signal\x20sent\x20successfully','โ
\x20[YOUTUBE\x20AUTH]\x20Backend\x20confirmed\x20refresh\x20token\x20received','โ
\x20[YOUTUBE\x20AUTH]\x20Full\x20YouTube\x20connection\x20with\x20persistent\x20access','JuPoW','bXLOg','JuEGG','UaEoj','lRwbq','VHgVO','zFOtW','BRsCX','xkOvG','YlRnT','mgmbT','ZkhGT','EjoTm','WObCw','statusCodes','FjgCf','IN_PROGRESS','fSJha','FvxuA','PLAY_SERVICES_NOT_AVAILABLE','UpaMV','โน๏ธ\x20No\x20existing\x20permissions\x20to\x20revoke:','๐ค\x20User:','โ
\x20Revoked\x20existing\x20permissions\x20-\x20fresh\x20consent\x20REQUIRED','๐\x20Signing\x20in\x20after\x20revoke\x20-\x20consent\x20screen\x20MUST\x20appear...','LLKHj','GXrmo','โ\x20Error\x20with\x20revoke\x20method:','nROvR','revokeAccess','CbODs','DUWcE','signOut','sEzkB','udYdM','mLPkQ','IcIvT','qAaIU','tKsFp','wBDAj','KppUu','pJNmA','\x20-\x20the\x20server\x20took\x20too\x20long\x20to\x20respond','vcwVA','\x20\x20\x203.\x20DNS\x20resolution\x20failed','โ\x20Still\x20no\x20refresh\x20token\x20after\x20revoke\x20method','VgNkb','๐\x20Method\x202:\x20Trying\x20forced\x20consent\x20via\x20revoke...','๐\x20Method\x201:\x20Trying\x20forced\x20consent\x20via\x20configuration...','tmADl','mfawO','NHMCZ','LvagA','faRxz','qUHMj','enQjl','\x20YouTube\x20connection\x20fixed\x20via\x20Method\x201!','TFzLQ','UJsPa','FanKx','dRCnK','GpywR','\x20YouTube\x20connection\x20fixed\x20via\x20Method\x202!','โ\x20Failed\x20to\x20fix\x20','\x20YouTube\x20connection\x20with\x20both\x20methods','โ\x20User\x20not\x20signed\x20in\x20to\x20Google,\x20cannot\x20refresh\x20tokens','โ\x20Failed\x20to\x20refresh\x20Google\x20tokens:','โ
\x20Successfully\x20refreshed\x20Google\x20tokens','rxkfG','vbmFE','aGhdI','oGMYq','๐\x20Refresh\x20failed,\x20attempting\x20re-authentication...','signIn','NpRDk','YJvuY','Skoxe','keWJx','๐\x20YouTube\x20Token\x20Debug:','โ\x20Debug\x20tokens\x20failed:','ljfZr','AIaWp','HCaVm','TAyeF','jcuLO','rRYDY','PrjZE','AuMYD','lbLdY','XtyvD','JQjfo','HAfLa','none','RpXkT','OoHPZ','โ
\x20Signed\x20out\x20from\x20Google','โน๏ธ\x20Already\x20signed\x20out\x20or\x20sign\x20out\x20failed:','โ
\x20Cleared\x20cached\x20access\x20token','QxmuS','โ
\x20YouTube\x20reconnected\x20successfully\x20with\x20refresh\x20token','aiJaq','โ\x20YouTube\x20reconnection\x20failed','โ\x20YouTube\x20reconnection\x20error:','LWezt','txKls','tIdXq','tFmAI','BiFtp','qeqqg','โน๏ธ\x20Token\x20clearing\x20failed\x20or\x20not\x20needed:','AQYly','uXgyA','โ
\x20Refresh\x20token\x20confirmed:','IEvDm','QDBjR','hzTjc','vogJX','Email\x20verified\x20successfully','โ\x20Error\x20testing\x20YouTube\x20refresh\x20token:','โ\x20Error\x20checking\x20email\x20verification\x20status:','1|4|5|2|3|0|6','Invalid\x20verification\x20code','โน๏ธ\x20User\x20should\x20authenticate\x20first\x20via\x20Google/Apple/Email\x20before\x20connecting\x20YouTube','tlEsF','amAbM','User\x20cancelled\x20Google\x20Sign-In','Google\x20Play\x20Services\x20not\x20available','UzXvY','๐\x20Signed\x20out\x20to\x20force\x20fresh\x20consent','๐\x20FULL\x20userInfo\x20object:','๐\x20FULL\x20tokens\x20object:','-\x20userInfo.data?.serverAuthCode:','-\x20currentUser?.serverAuthCode:','-\x20tokens.idToken:','wWlAk','yWDXR','xdhgZ','โ
\x20Refresh\x20token\x20available\x20for\x20YouTube\x20connection','๐บ\x20Fetching\x20YouTube\x20channel\x20information...','uGOtT','onairos_username','youtube_user','lweuT','โน๏ธ\x20NOTE:\x20SDK\x20does\x20not\x20create\x20users\x20during\x20YouTube\x20connection','โ
\x20Found\x20existing\x20authentication\x20token\x20for\x20YouTube\x20auth','๐\x20Linking\x20YouTube\x20data\x20to\x20user:','-\x20hasRefreshToken:','-\x20hasServerAuthCode:','-\x20userEmail:','-\x20channelName:','๐\x20COMPLETE\x20BACKEND\x20PAYLOAD:','๐ค\x20Sending\x20YouTube\x20auth\x20to\x20backend\x20with\x20refresh\x20token:','๐ก\x20Backend\x20response\x20headers:','hjNAc','๐\x20[YOUTUBE\x20AUTH]\x20YouTube\x20connected\x20in\x20temporary\x20mode','lRvOW','โ ๏ธ\x20[YOUTUBE\x20AUTH]\x20Backend\x20did\x20not\x20confirm\x20refresh\x20token','โ ๏ธ\x20[YOUTUBE\x20AUTH]\x20Connection\x20may\x20fail\x20when\x20tokens\x20expire','โ\x20YouTube\x20auth\x20failed:','๐\x20BACKEND\x20ERROR\x20RESPONSE:','aHzdq','โ\x20Google\x20Sign-In\x20error:','Ctgvu','instagram','Initiating\x20Facebook\x20Login\x20for\x20Instagram','๐\x20Initiating\x20native\x20Google\x20Sign-In\x20for\x20YouTube','trim','โ\x20[YOUTUBE\x20AUTH]\x20Username\x20is\x20required\x20for\x20YouTube\x20authentication','bCKlD','rDUqt','โน๏ธ\x20Sign\x20out\x20not\x20needed\x20or\x20failed:','โ
\x20Google\x20Sign-In\x20successful:','gCOvz','xcLiR','yRvzH','GowKp','FnAtZ','UOLXf','WipMy','๐\x20FULL\x20currentUser\x20object:','jSfcs','AAIkb','liAVv','Present:\x20','fpjdQ','RTRSi','ouijm','KMZXY','ukJjx','โ
\x20Got\x20serverAuthCode\x20(refresh\x20token\x20mechanism)','GkSrn','hFTHz','GdpAR','GnsDQ','FIqKp','๐ก\x20Check\x20Google\x20Sign-In\x20configuration:\x20offlineAccess,\x20forceCodeForRefreshToken','โ ๏ธ\x20Continuing\x20without\x20refresh\x20token\x20-\x20connection\x20may\x20fail\x20later','DfEIB','token','PbrCQ','oMUsa','sUFZP','iAMTv','qiFei','rAwPQ','GagIU','GbXmb','jnsDt','SjrVO','oZmlJ','PcgeK','XKFDv','FVFwG','TXtct','wwoGG','odVgv','XxhVn','kUqLV','dWTzV','ipxos','hppyL','VKcVE','BEeSp','TLoVF','MYZoK','RiPiy','default','BWcUZ','iBZrQ','KRcBc','gXBip','TOxAi','qNmOE','MJPTh','๐\x20[YOUTUBE\x20REAUTH]\x20Refresh\x20token\x20sent:','TJpau','wllwy','mQvew','xUjLf','No\x20token','IzNsZ','frGmk','PDYEa','WHEyl','YvRkU','cZRfO','pseYS','OQcPL','DkoIR','๐ค\x20BACKEND\x20PAYLOAD\x20SUMMARY:','-\x20hasAccessToken:','-\x20refreshTokenType:','igpyC','SNLGU','zrhAP','XxMim','pkQRe','oXsVn','VWMpU','VYjom','json','โ
\x20YouTube\x20connection\x20successful','dLkPA','aLhLX','isTemporaryMode','Hdadd','dgrlT','NWoVg','WYQad','AcKNu','jRVbL','VwGNi','GQUoN','rHHuZ','bLSsG','REMcU','ZdvSJ','keys','XnVJg','lbcFR','dCKQi','vSNEB','SIGN_IN_CANCELLED','WQNqe','BFOoz','SbkcJ','PSuyc','obrNZ','FXijt','bdzwK','TnjFo','GyQlL','reQyK','GMCZV','YSVyD','pvEmg','pYmOM','ulfWv','DHqis','ZPUyW','rFQgA','Facebook\x20Login\x20completed\x20successfully','zwWjA','TSvMc','ejoEb','Google\x20Sign-In\x20already\x20in\x20progress','PGrOi','code=','UKEOB','Exchanging\x20code\x20for\x20token\x20for\x20platform:\x20','/token','euumI','OOZtt','WVpKA','Error\x20exchanging\x20code\x20for\x20token:\x20','Token\x20exchange\x20failed\x20with\x20status\x20','Token\x20exchange\x20successful\x20for\x20','tpVul','Error\x20exchanging\x20code\x20for\x20token:','Falling\x20back\x20to\x20simulated\x20token\x20response','_access_token_','random','toString','_refresh_token_','nxGfd','๐\x20[YOUTUBE\x20AUTH]\x20Response\x20data\x20keys:','YqGtZ','exchangeCodeForToken','โ\x20CRITICAL:\x20No\x20refresh\x20token\x20even\x20after\x20consent\x20screen','โ\x20Failed\x20to\x20get\x20fresh\x20tokens\x20from\x20Google\x20SDK','โ
\x20YouTube\x20tokens\x20refreshed\x20successfully:','pFZMA','cMwuZ','โ\x20Error\x20refreshing\x20YouTube\x20tokens:','jXzQJ','YPKQL','XwWLT','dGQWf','dCzrG','QTCvw','Ykjve','WRQHY','XkRMx','cBcUo','ktkuJ','getJWT','โ\x20No\x20auth\x20token\x20found\x20for\x20YouTube\x20refresh','bgcua','BverD','CyqoY','ZyspC','mUGYh','tslUN','lUlpB','mFQTZ','aNqRb','โ\x20YouTube\x20token\x20refresh\x20failed:','ajXeW','TZCRo','wbWhI','zRebB','ToPlE','QkkiM','uZRlO','UmOlt','refreshYouTubeTokens','๐\x20[TRAINING\x20RESTART]\x20Triggering\x20training\x20restart\x20for\x20user:','youtube_reauth','โ
\x20[TRAINING\x20RESTART]\x20Training\x20restart\x20successful:','BEBHw','โ\x20[TRAINING\x20RESTART]\x20Error\x20triggering\x20training\x20restart:','tqvBf','RICwH','/mobile-training/restart','lwQER','KqHkR','dQmZX','0|2|5|1|4|3','\x20\x20\x205.\x20iOS\x20simulator\x20network\x20sandbox\x20issue\x20-\x20try\x20on\x20physical\x20device','muPIJ','xmNRr','UJMPy','โ
\x20YouTube\x20connection\x20fixed!\x20Testing\x20again...','MUfdA','โ\x20Failed\x20to\x20fix\x20YouTube\x20connection','kddEp','bsMMr','๐งช\x20Testing\x20YouTube\x20refresh\x20token\x20functionality...','MIPhS','IhksZ','EmTYl','lpNQY','HRSal','VSbun','โ ๏ธ\x20No\x20refresh\x20token\x20found\x20-\x20attempting\x20to\x20fix...','MoGwj','gEvvp','gaYKt','GEUQg','PSiMa','mQofv','ZpDUJ','๐\x20New\x20token\x20status:','pazlw','glWit','tyeVN','kbhJG','qPzXh','tguIv','โ
\x20Got\x20serverAuthCode\x20from\x20sign-in\x20response','gxpOn','PvRaK','EjjTQ','oEJNN','BDxYy','ARmFy','request','Failed\x20to\x20send\x20verification\x20code','โ\x20Error\x20requesting\x20email\x20verification:','gqDFQ','ntOqg','/email/verification','oVSmM','iOOjn','Verification\x20code\x20sent\x20to\x20your\x20email','BKGhB','NzvlC','IreHD','verify','TSTKm','๐\x20Verifying\x20email\x20code\x20for:','ZnUGM','pskFn','JEmFO','existingUser','pMEgn','kkJnK','EBDKW','jPFOe','Network\x20error','aZqSv','VZrfH','isPending','gdbMj','๐ง\x20Platform\x20auth\x20service\x20initialized','GefvH','OBeCS'];_0x5e9e=function(){return _0x767b8b;};return _0x5e9e();}function _0x3d52(_0x5e9e0b,_0x3d52e1){_0x5e9e0b=_0x5e9e0b-0x0;const _0x37d11d=_0x5e9e();let _0x2c7c95=_0x37d11d[_0x5e9e0b];return _0x2c7c95;}exports[_0x3d52(0x2de)]=refreshYouTubeTokens;const triggerTrainingRestart=async(_0x36b67e,_0x321816)=>{const _0x3b51c1={'QuYBS':'No\x20API\x20key\x20configured.\x20Please\x20initialize\x20the\x20SDK\x20with\x20a\x20valid\x20developer\x20API\x20key.','tqvBf':function(_0x9d2b90,_0x10a537){return _0x9d2b90!==_0x10a537;},'eZytG':'Tfshk','uLOYl':_0x3d52(0x2df),'RICwH':function(_0x4127ef,_0x16aa1e,_0x562dd8){return _0x4127ef(_0x16aa1e,_0x562dd8);},'yJleV':_0x3d52(0x2e0),'lwQER':_0x3d52(0x2e1),'KqHkR':_0x3d52(0x2e2),'dQmZX':'โ\x20[TRAINING\x20RESTART]\x20Training\x20restart\x20failed:','GBXmQ':_0x3d52(0x2e3)};try{if(_0x3b51c1[_0x3d52(0x2e4)]('dwcJy',_0x3b51c1['eZytG'])){console[_0x3d52(0x46)](_0x3b51c1['uLOYl'],_0x36b67e);const _0x1875de=await _0x3b51c1[_0x3d52(0x2e5)](fetch,_api[_0x3d52(0x26)][_0x3d52(0x27)]+_0x3d52(0x2e6),{'method':'POST','headers':{'Content-Type':'application/json','Authorization':_0x321816},'body':JSON['stringify']({'username':_0x36b67e,'reason':_0x3b51c1['yJleV'],'platform':_0x3d52(0xc3),'timestamp':new Date()[_0x3d52(0x131)](),'requestNewTraining':!![]})});if(_0x1875de['ok']){const _0x18c2a4=await _0x1875de[_0x3d52(0x275)]();console[_0x3d52(0x46)](_0x3b51c1[_0x3d52(0x2e7)],_0x18c2a4);}else{if(_0x3d52(0x2e2)!==_0x3b51c1[_0x3d52(0x2e8)])_0x3e4bbe[_0x3d52(0x46)]('โ ๏ธ\x20[CONNECTIVITY]\x20API\x20server\x20responded\x20with\x20status:\x20'+_0x141697[_0x3d52(0x5e)]);else{const _0x3b7392=await _0x1875de['text']();console['error'](_0x3b51c1[_0x3d52(0x2e9)],_0x1875de[_0x3d52(0x5e)],_0x3b7392);throw new Error('Training\x20restart\x20failed:\x20'+_0x1875de[_0x3d52(0x5e)]);}}}else throw new _0x5d160f(_0x3b51c1['QuYBS']);}catch(_0x16dde9){console[_0x3d52(0x18)](_0x3b51c1['GBXmQ'],_0x16dde9);throw _0x16dde9;}},testYouTubeRefreshToken=async _0x2dcdeb=>{const _0x51b577={'HRSal':_0x3d52(0x42),'gEvvp':'โ
\x20Refresh\x20token\x20available\x20for\x20YouTube\x20connection','gaYKt':_0x3d52(0xb7),'GEUQg':_0x3d52(0xc4),'PSiMa':_0x3d52(0xb8),'tyeVN':_0x3d52(0x2ea),'kbhJG':_0x3d52(0x19d),'BRAxX':_0x3d52(0x2eb),'Qwyui':_0x3d52(0x72),'qPzXh':_0x3d52(0x71),'gxpOn':_0x3d52(0x115),'BDxYy':function(_0x4e7be3,_0x344b4f,_0x516059){return _0x4e7be3(_0x344b4f,_0x516059);},'aszew':_0x3d52(0x29e),'oEJNN':'Initiating\x20Facebook\x20Login\x20for\x20Instagram','MIPhS':_0x3d52(0x187),'IhksZ':function(_0x5c87c3,_0xa29992){return _0x5c87c3===_0xa29992;},'EmTYl':_0x3d52(0x2ec),'lpNQY':_0x3d52(0x2ed),'eQvBF':'๐\x20Current\x20token\x20status:','FUpmj':function(_0xbdb120,_0x3aac1a){return _0xbdb120!==_0x3aac1a;},'VSbun':'zyijy','MoGwj':function(_0x43ab41,_0x30c13c){return _0x43ab41(_0x30c13c);},'kfNKr':_0x3d52(0x2ee),'mQofv':_0x3d52(0x2ef),'ZpDUJ':function(_0x202a5d){return _0x202a5d();},'pazlw':function(_0x5a8306,_0x49f350){return _0x5a8306!==_0x49f350;},'glWit':_0x3d52(0x2f0),'tguIv':_0x3d52(0x2f1),'PvRaK':_0x3d52(0x2f2),'EjjTQ':_0x3d52(0x2f3),'ARmFy':_0x3d52(0x76)};console[_0x3d52(0x46)](_0x3d52(0x2f4)),console[_0x3d52(0x46)](_0x51b577[_0x3d52(0x2f5)],_0x2dcdeb);try{if(_0x51b577[_0x3d52(0x2f6)](_0x51b577[_0x3d52(0x2f7)],_0x51b577[_0x3d52(0x2f8)]))_0x4eaa7a['log'](_0x51b577[_0x3d52(0x2f9)]);else{const _0x363f05=await debugYouTubeTokens();console[_0x3d52(0x46)](_0x51b577['eQvBF'],_0x363f05);if(!_0x363f05[_0x3d52(0x15d)]){if(_0x51b577['FUpmj'](_0x51b577[_0x3d52(0x2fa)],'nmxXI')){console[_0x3d52(0x46)](_0x3d52(0x2fb));const _0x489a74=await _0x51b577[_0x3d52(0x2fc)](fixUserYouTubeConnection,_0x2dcdeb);if(_0x489a74){if(_0x51b577['FUpmj'](_0x51b577['kfNKr'],_0x51b577['kfNKr']))_0x5e4da7[_0x3d52(0x46)](_0x51b577[_0x3d52(0x2fd)]),_0x31c8ae['log'](_0x51b577[_0x3d52(0x2fe)],_0x246291[_0x3d52(0x114)]('4/')?_0x51b577[_0x3d52(0x2ff)]:_0x51b577[_0x3d52(0x300)]);else{console[_0x3d52(0x46)](_0x51b577[_0x3d52(0x301)]);const _0x40e5c9=await _0x51b577[_0x3d52(0x302)](debugYouTubeTokens);console[_0x3d52(0x46)](_0x3d52(0x303),_0x40e5c9);}}else{if(_0x51b577[_0x3d52(0x304)](_0x51b577[_0x3d52(0x305)],_0x51b577[_0x3d52(0x305)])){const _0x5be4e2=_0x51b577[_0x3d52(0x306)][_0x3d52(0x99)]('|');let _0x50d1bf=0x0;while(!![]){switch(_0x5be4e2[_0x50d1bf++]){case'0':_0x1d0e9c[_0x3d52(0x18)](_0x3d52(0x9b)+_0x2f1a27+_0x3d52(0x9c));continue;case'1':_0x117cfa[_0x3d52(0x18)](_0x51b577[_0x3d52(0x307)]);continue;case'2':_0x56551e['error'](_0x3d52(0x73));continue;case'3':_0x2712a9[_0x3d52(0x18)](_0x51b577['BRAxX']);continue;case'4':_0x7af86c[_0x3d52(0x18)](_0x51b577['Qwyui']);continue;case'5':_0x35b8cf[_0x3d52(0x18)](_0x51b577[_0x3d52(0x308)]);continue;}break;}}else console[_0x3d52(0x18)](_0x51b577[_0x3d52(0x309)]);}}else _0x39b025=_0xfb82ac['data'][_0x3d52(0xc4)],_0x4ef373[_0x3d52(0x46)](_0x3d52(0x30a)),_0x46e52c[_0x3d52(0x46)](_0x51b577[_0x3d52(0x30b)],_0x102445[_0x3d52(0x5c)](0x0,0x14)+_0x3d52(0x10c));}else{if(_0x51b577[_0x3d52(0x2f6)](_0x51b577[_0x3d52(0x30c)],_0x51b577[_0x3d52(0x30d)])){const _0x1b02a3={'QgijT':_0x51b577['aszew']};return _0x4e123c[_0x3d52(0x46)](_0x51b577[_0x3d52(0x30e)]),new _0xdddee2(_0x157a92=>{_0x51b577[_0x3d52(0x30f)](_0xeb0a5d,()=>{_0x124320[_0x3d52(0x46)](_0x1b02a3['QgijT']),_0x157a92(!![]);},0x3e8);});}else console['log'](_0x51b577[_0x3d52(0x310)]);}}}catch(_0x285826){console['error'](_0x3d52(0x1e7),_0x285826);}};exports['testYouTubeRefreshToken']=testYouTubeRefreshToken;const requestEmailVerification=async(_0x5c871c,_0x359305=![])=>{const _0x3aad62={'gqDFQ':'๐ง\x20Requesting\x20email\x20verification\x20for:','ntOqg':function(_0x1af0c7,_0x1ca223,_0x3dc8f2){return _0x1af0c7(_0x1ca223,_0x3dc8f2);},'oVSmM':function(_0x23bc7a){return _0x23bc7a();},'iOOjn':_0x3d52(0x311),'BKGhB':_0x3d52(0x312),'NzvlC':_0x3d52(0x313),'IreHD':'Network\x20error.\x20Please\x20check\x20your\x20connection\x20and\x20try\x20again.'};try{console[_0x3d52(0x46)](_0x3aad62[_0x3d52(0x314)],_0x5c871c);const _0x509b03=await _0x3aad62[_0x3d52(0x315)](fetch,_api[_0x3d52(0x26)][_0x3d52(0x27)]+_0x3d52(0x316),{'method':'POST','headers':_0x3aad62[_0x3d52(0x317)](getDeveloperAuthHeaders),'body':JSON[_0x3d52(0x8c)]({'email':_0x5c871c,'action':_0x3aad62[_0x3d52(0x318)],'testMode':_0x359305})}),_0x5f0703=await _0x509b03[_0x3d52(0x275)]();return _0x509b03['ok']?{'success':!![],'message':_0x5f0703[_0x3d52(0x16)]||_0x3d52(0x319)}:{'success':![],'error':_0x5f0703['message']||_0x3aad62[_0x3d52(0x31a)]};}catch(_0x5ad930){return console['error'](_0x3aad62[_0x3d52(0x31b)],_0x5ad930),{'success':![],'error':_0x3aad62[_0x3d52(0x31c)]};}};exports[_0x3d52(0x3)]=requestEmailVerification;const verifyEmailCode=async(_0x4a17b1,_0x1a9e34,_0x4b9767=![])=>{const _0x572a32={'kkJnK':_0x3d52(0xa0),'EBDKW':_0x3d52(0xa1),'ZnUGM':function(_0x159612,_0x37fb55,_0x4a86ba){return _0x159612(_0x37fb55,_0x4a86ba);},'kaRAe':function(_0x167558){return _0x167558();},'pskFn':_0x3d52(0x31d),'JEmFO':_0x3d52(0x1e6),'pMEgn':_0x3d52(0x1ea),'pCNIU':_0x3d52(0x31e),'Tcmyh':_0x3d52(0xa6),'jPFOe':_0x3d52(0xa7)};try{console[_0x3d52(0x46)](_0x3d52(0x31f),_0x4a17b1);const _0x52debb=await _0x572a32[_0x3d52(0x320)](fetch,_api[_0x3d52(0x26)][_0x3d52(0x27)]+_0x3d52(0x316),{'method':'POST','headers':_0x572a32['kaRAe'](getDeveloperAuthHeaders),'body':JSON['stringify']({'email':_0x4a17b1,'code':_0x1a9e34,'action':_0x572a32[_0x3d52(0x321)],'testMode':_0x4b9767})}),_0x3abb43=await _0x52debb['json']();return _0x52debb['ok']?{'success':!![],'message':_0x3abb43[_0x3d52(0x16)]||_0x572a32[_0x3d52(0x322)],'existingUser':_0x3abb43[_0x3d52(0x323)]||![],'token':_0x3abb43[_0x3d52(0x237)]}:{'success':![],'error':_0x3abb43[_0x3d52(0x16)]||_0x572a32[_0x3d52(0x324)]};}catch(_0x3f4b1b){if(_0x572a32['pCNIU']==='RYBGH')_0x20532a[_0x3d52(0xa2)][_0x3d52(0xa3)]({'webClientId':_0x592814,'iosClientId':_0x5ec1ee,'offlineAccess':!![],'forceCodeForRefreshToken':!![],'scopes':[_0x3d52(0x29),'openid',_0x572a32[_0x3d52(0x325)],_0x572a32[_0x3d52(0x326)]],'hostedDomain':'','accountName':''});else return console[_0x3d52(0x18)](_0x572a32['Tcmyh'],_0x3f4b1b),{'success':![],'error':_0x572a32[_0x3d52(0x327)]};}};exports[_0x3d52(0x1)]=verifyEmailCode;const checkEmailVerificationStatus=async(_0x46250f,_0x35d60d=![])=>{const _0x519def={'aZqSv':function(_0x5e98ed,_0xf3141c,_0x57c95a){return _0x5e98ed(_0xf3141c,_0x57c95a);},'VZrfH':function(_0x111acf){return _0x111acf();},'gdbMj':_0x3d52(0x328)};try{const _0x54dff8=await _0x519def[_0x3d52(0x329)](fetch,_api[_0x3d52(0x26)]['BASE_URL']+'/email/verification/status',{'method':'POST','headers':_0x519def[_0x3d52(0x32a)](getDeveloperAuthHeaders),'body':JSON[_0x3d52(0x8c)]({'email':_0x46250f,'testMode':_0x35d60d})}),_0x3d915e=await _0x54dff8[_0x3d52(0x275)]();return{'success':_0x54dff8['ok'],'isPending':_0x3d915e[_0x3d52(0x32b)]||![],'message':_0x3d915e['message']};}catch(_0x337f5c){return console[_0x3d52(0x18)](_0x3d52(0x1e8),_0x337f5c),{'success':![],'isPending':![],'error':_0x519def[_0x3d52(0x32c)]};}};exports['checkEmailVerificationStatus']=checkEmailVerificationStatus;const initializePlatformAuthService=()=>{const _0x143224={'GefvH':_0x3d52(0x32d),'OBeCS':function(_0x3bc43d){return _0x3bc43d();}};console[_0x3d52(0x46)](_0x143224[_0x3d52(0x32e)]),_0x143224[_0x3d52(0x32f)](initializeGoogleSignIn);};exports[_0x3d52(0x8)]=initializePlatformAuthService;
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.verifyEmailCode = exports.testYouTubeRefreshToken = exports.testApiConnectivity = exports.requestEmailVerification = exports.refreshYouTubeTokens = exports.reconnectYouTube = exports.isOAuthCallback = exports.initiateOAuth = exports.initiateNativeAuth = exports.initializePlatformAuthService = exports.hasNativeSDK = exports.forceYouTubeReconnectionWithRevoke = exports.forceYouTubeReconnectionWithConsent = exports.fixUserYouTubeConnection = exports.exchangeCodeForToken = exports.checkEmailVerificationStatus = void 0;
|
|
7
|
+
var _reactNative = require("react-native");
|
|
8
|
+
var _googleSignin = require("@react-native-google-signin/google-signin");
|
|
9
|
+
var _asyncStorage = _interopRequireDefault(require("@react-native-async-storage/async-storage"));
|
|
10
|
+
var _api = require("../config/api");
|
|
11
|
+
var _apiKeyService = require("./apiKeyService");
|
|
12
|
+
var _jwtStorageService = require("./jwtStorageService");
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
+
/**
|
|
15
|
+
* Platform Authentication Service
|
|
16
|
+
* Handles OAuth flows for different platforms
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
// CRITICAL FIX: Use static imports to avoid Hermes transpilation issues
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Get developer API key authorization headers
|
|
23
|
+
* This ensures all auth requests include the developer's API key for backend validation
|
|
24
|
+
* @throws Error if SDK is not initialized with a valid API key
|
|
25
|
+
*/
|
|
26
|
+
const getDeveloperAuthHeaders = () => {
|
|
27
|
+
if (!(0, _apiKeyService.isApiKeyInitialized)()) {
|
|
28
|
+
throw new Error('SDK not initialized. Developers must call initializeApiKey() before using auth features.');
|
|
29
|
+
}
|
|
30
|
+
const config = (0, _apiKeyService.getApiConfig)();
|
|
31
|
+
if (!(config !== null && config !== void 0 && config.apiKey)) {
|
|
32
|
+
throw new Error('No API key configured. Please initialize the SDK with a valid developer API key.');
|
|
33
|
+
}
|
|
34
|
+
return {
|
|
35
|
+
...(0, _api.getApiHeaders)(),
|
|
36
|
+
'Authorization': `Bearer ${config.apiKey}`,
|
|
37
|
+
'X-SDK-Version': '3.0.72',
|
|
38
|
+
'X-SDK-Platform': 'react-native'
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
// ๐ CRITICAL: Using the same client ID for both web and iOS to avoid audience errors
|
|
43
|
+
const WEB_CLIENT_ID = '1030678346906-lovkuds2ouqmoc8eu5qpo98spa6edv4o.apps.googleusercontent.com';
|
|
44
|
+
const IOS_CLIENT_ID = '1030678346906-lovkuds2ouqmoc8eu5qpo98spa6edv4o.apps.googleusercontent.com';
|
|
45
|
+
// OAuth configuration for different platforms
|
|
46
|
+
const OAUTH_CONFIG = {
|
|
47
|
+
instagram: {
|
|
48
|
+
authUrl: 'https://api.instagram.com/oauth/authorize',
|
|
49
|
+
clientId: 'demo_instagram_client_id',
|
|
50
|
+
redirectUri: 'onairosevents://auth/callback',
|
|
51
|
+
scope: 'user_profile,user_media',
|
|
52
|
+
responseType: 'code',
|
|
53
|
+
hasNativeSDK: false
|
|
54
|
+
},
|
|
55
|
+
youtube: {
|
|
56
|
+
authUrl: `${_api.API_CONFIG.BASE_URL}/youtube/authorize`,
|
|
57
|
+
clientId: '1030678346906-lovkuds2ouqmoc8eu5qpo98spa6edv4o.apps.googleusercontent.com',
|
|
58
|
+
redirectUri: 'onairosevents://auth/callback',
|
|
59
|
+
scope: 'https://www.googleapis.com/auth/youtube.readonly',
|
|
60
|
+
responseType: 'code',
|
|
61
|
+
hasNativeSDK: true // Changed to true for native SDK
|
|
62
|
+
},
|
|
63
|
+
reddit: {
|
|
64
|
+
authUrl: `${_api.API_CONFIG.BASE_URL}/reddit/authorize`,
|
|
65
|
+
clientId: 'demo_reddit_client_id',
|
|
66
|
+
redirectUri: 'onairosevents://auth/callback',
|
|
67
|
+
scope: 'identity,read',
|
|
68
|
+
responseType: 'code',
|
|
69
|
+
hasNativeSDK: false
|
|
70
|
+
},
|
|
71
|
+
pinterest: {
|
|
72
|
+
authUrl: `${_api.API_CONFIG.BASE_URL}/pinterest/authorize`,
|
|
73
|
+
clientId: 'demo_pinterest_client_id',
|
|
74
|
+
redirectUri: 'onairosevents://auth/callback',
|
|
75
|
+
scope: 'boards:read,pins:read',
|
|
76
|
+
responseType: 'code',
|
|
77
|
+
hasNativeSDK: false
|
|
78
|
+
},
|
|
79
|
+
facebook: {
|
|
80
|
+
authUrl: 'https://www.facebook.com/v12.0/dialog/oauth',
|
|
81
|
+
clientId: 'demo_facebook_client_id',
|
|
82
|
+
redirectUri: 'onairosevents://auth/callback',
|
|
83
|
+
scope: 'public_profile,email',
|
|
84
|
+
responseType: 'code',
|
|
85
|
+
hasNativeSDK: false
|
|
86
|
+
},
|
|
87
|
+
// GitHub connector is temporarily commented out
|
|
88
|
+
// github: {
|
|
89
|
+
// authUrl: 'https://github.com/login/oauth/authorize',
|
|
90
|
+
// clientId: 'demo_github_client_id',
|
|
91
|
+
// redirectUri: 'onairosevents://auth/callback',
|
|
92
|
+
// scope: 'repo,user',
|
|
93
|
+
// responseType: 'code',
|
|
94
|
+
// hasNativeSDK: false
|
|
95
|
+
// },
|
|
96
|
+
linkedin: {
|
|
97
|
+
authUrl: `${_api.API_CONFIG.BASE_URL}/linkedin/authorize`,
|
|
98
|
+
clientId: '',
|
|
99
|
+
// No client ID needed - backend handles OAuth
|
|
100
|
+
redirectUri: 'onairosevents://auth/callback',
|
|
101
|
+
scope: 'openid profile email',
|
|
102
|
+
// Updated to OpenID Connect scopes as per your backend
|
|
103
|
+
responseType: 'code',
|
|
104
|
+
hasNativeSDK: false // LinkedIn has no modern native SDK
|
|
105
|
+
},
|
|
106
|
+
gmail: {
|
|
107
|
+
authUrl: `${_api.API_CONFIG.BASE_URL}/gmail/authorize`,
|
|
108
|
+
clientId: 'demo_gmail_client_id',
|
|
109
|
+
redirectUri: 'onairosevents://auth/callback',
|
|
110
|
+
scope: 'https://www.googleapis.com/auth/gmail.readonly',
|
|
111
|
+
responseType: 'code',
|
|
112
|
+
hasNativeSDK: false
|
|
113
|
+
},
|
|
114
|
+
email: {
|
|
115
|
+
// Email doesn't use OAuth but we still need to handle it in the flow
|
|
116
|
+
hasNativeSDK: false,
|
|
117
|
+
authUrl: `${_api.API_CONFIG.BASE_URL}/email/authorize` // Proxy endpoint for email verification
|
|
118
|
+
},
|
|
119
|
+
// LLM Platforms - use direct login URLs (WebView handles extraction)
|
|
120
|
+
// These platforms use WebView-based login + JavaScript injection for data export
|
|
121
|
+
chatgpt: {
|
|
122
|
+
authUrl: 'https://chat.openai.com',
|
|
123
|
+
// Direct login URL - WebView injects export scripts
|
|
124
|
+
clientId: '',
|
|
125
|
+
redirectUri: '',
|
|
126
|
+
scope: '',
|
|
127
|
+
responseType: '',
|
|
128
|
+
hasNativeSDK: false
|
|
129
|
+
},
|
|
130
|
+
claude: {
|
|
131
|
+
authUrl: 'https://claude.ai/login',
|
|
132
|
+
// Direct login URL - WebView injects export scripts
|
|
133
|
+
clientId: '',
|
|
134
|
+
redirectUri: '',
|
|
135
|
+
scope: '',
|
|
136
|
+
responseType: '',
|
|
137
|
+
hasNativeSDK: false
|
|
138
|
+
},
|
|
139
|
+
gemini: {
|
|
140
|
+
authUrl: 'https://gemini.google.com',
|
|
141
|
+
// Direct login URL - WebView injects export scripts
|
|
142
|
+
clientId: '',
|
|
143
|
+
redirectUri: '',
|
|
144
|
+
scope: '',
|
|
145
|
+
responseType: '',
|
|
146
|
+
hasNativeSDK: false
|
|
147
|
+
},
|
|
148
|
+
grok: {
|
|
149
|
+
authUrl: 'https://x.com/i/grok',
|
|
150
|
+
// Direct login URL (via X) - WebView injects export scripts
|
|
151
|
+
clientId: '',
|
|
152
|
+
redirectUri: '',
|
|
153
|
+
scope: '',
|
|
154
|
+
responseType: '',
|
|
155
|
+
hasNativeSDK: false
|
|
156
|
+
},
|
|
157
|
+
// ============================================================
|
|
158
|
+
// NEW PLATFORMS - WebView-based extraction
|
|
159
|
+
// API endpoints are PLACEHOLDERS - fill in once known
|
|
160
|
+
// ============================================================
|
|
161
|
+
hinge: {
|
|
162
|
+
authUrl: 'https://hinge.co',
|
|
163
|
+
// PLACEHOLDER - may need mobile web URL
|
|
164
|
+
clientId: '',
|
|
165
|
+
redirectUri: '',
|
|
166
|
+
scope: '',
|
|
167
|
+
responseType: '',
|
|
168
|
+
hasNativeSDK: false
|
|
169
|
+
},
|
|
170
|
+
// Instagram WebView extraction (different from OAuth Instagram)
|
|
171
|
+
instagram_webview: {
|
|
172
|
+
authUrl: 'https://www.instagram.com',
|
|
173
|
+
// Direct login - WebView injects export scripts
|
|
174
|
+
clientId: '',
|
|
175
|
+
redirectUri: '',
|
|
176
|
+
scope: '',
|
|
177
|
+
responseType: '',
|
|
178
|
+
hasNativeSDK: false
|
|
179
|
+
},
|
|
180
|
+
sephora: {
|
|
181
|
+
authUrl: 'https://www.sephora.com',
|
|
182
|
+
// Direct login - WebView injects export scripts
|
|
183
|
+
clientId: '',
|
|
184
|
+
redirectUri: '',
|
|
185
|
+
scope: '',
|
|
186
|
+
responseType: '',
|
|
187
|
+
hasNativeSDK: false
|
|
188
|
+
},
|
|
189
|
+
// ============================================================
|
|
190
|
+
// TELEGRAM - MTProto API WebView-based extraction
|
|
191
|
+
// Uses web.telegram.org/k/ for login, extracts via IndexedDB
|
|
192
|
+
//
|
|
193
|
+
// MTProto API methods used:
|
|
194
|
+
// - messages.getDialogs: Get user's chat list
|
|
195
|
+
// - messages.getHistory: Get messages from a chat
|
|
196
|
+
//
|
|
197
|
+
// Backend should use Telethon/Pyrogram/TDLib for full API access
|
|
198
|
+
// @see https://core.telegram.org/api
|
|
199
|
+
// ============================================================
|
|
200
|
+
telegram: {
|
|
201
|
+
authUrl: 'https://web.telegram.org/k/',
|
|
202
|
+
// Telegram Web K - WebView injects export scripts
|
|
203
|
+
clientId: '',
|
|
204
|
+
// Not used - MTProto uses api_id/api_hash
|
|
205
|
+
redirectUri: '',
|
|
206
|
+
scope: '',
|
|
207
|
+
responseType: '',
|
|
208
|
+
hasNativeSDK: false
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Check if the platform has a native SDK
|
|
214
|
+
*/
|
|
215
|
+
const hasNativeSDK = platform => {
|
|
216
|
+
var _OAUTH_CONFIG$platfor;
|
|
217
|
+
return ((_OAUTH_CONFIG$platfor = OAUTH_CONFIG[platform]) === null || _OAUTH_CONFIG$platfor === void 0 ? void 0 : _OAUTH_CONFIG$platfor.hasNativeSDK) || false;
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Test API connectivity before making OAuth requests
|
|
222
|
+
*/
|
|
223
|
+
exports.hasNativeSDK = hasNativeSDK;
|
|
224
|
+
const testApiConnectivity = async () => {
|
|
225
|
+
const results = {
|
|
226
|
+
googleTest: null,
|
|
227
|
+
api2Test: null
|
|
228
|
+
};
|
|
229
|
+
try {
|
|
230
|
+
var _results$api2Test, _results$googleTest;
|
|
231
|
+
console.log('๐ [CONNECTIVITY] Running comprehensive network diagnostics...');
|
|
232
|
+
|
|
233
|
+
// Test 1: Can we reach Google? (known good endpoint)
|
|
234
|
+
console.log('๐ [CONNECTIVITY] Test 1: Checking general internet (google.com)...');
|
|
235
|
+
try {
|
|
236
|
+
const googleResponse = await fetch('https://www.google.com', {
|
|
237
|
+
method: 'HEAD',
|
|
238
|
+
// @ts-ignore - mode not always available in React Native
|
|
239
|
+
mode: 'no-cors'
|
|
240
|
+
});
|
|
241
|
+
results.googleTest = {
|
|
242
|
+
success: true,
|
|
243
|
+
status: 'reachable'
|
|
244
|
+
};
|
|
245
|
+
console.log('โ
[CONNECTIVITY] Google is reachable - internet is working');
|
|
246
|
+
} catch (googleError) {
|
|
247
|
+
results.googleTest = {
|
|
248
|
+
success: false,
|
|
249
|
+
error: googleError.message
|
|
250
|
+
};
|
|
251
|
+
console.error('โ [CONNECTIVITY] Cannot reach Google - internet may be down:', googleError.message);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
// Test 2: Can we reach API server?
|
|
255
|
+
console.log('๐ [CONNECTIVITY] Test 2: Checking API server...');
|
|
256
|
+
try {
|
|
257
|
+
const controller = new AbortController();
|
|
258
|
+
const timeoutId = setTimeout(() => controller.abort(), 30000); // Increased to 30s for simulator
|
|
259
|
+
|
|
260
|
+
const response = await fetch(`${_api.API_CONFIG.BASE_URL}/health`, {
|
|
261
|
+
method: 'GET',
|
|
262
|
+
signal: controller.signal
|
|
263
|
+
});
|
|
264
|
+
clearTimeout(timeoutId);
|
|
265
|
+
const responseText = await response.text().catch(() => 'Unable to read response');
|
|
266
|
+
results.api2Test = {
|
|
267
|
+
success: response.ok,
|
|
268
|
+
status: response.status,
|
|
269
|
+
statusText: response.statusText,
|
|
270
|
+
response: responseText.substring(0, 200) // First 200 chars
|
|
271
|
+
};
|
|
272
|
+
if (response.ok) {
|
|
273
|
+
console.log('โ
[CONNECTIVITY] API server is reachable');
|
|
274
|
+
} else {
|
|
275
|
+
console.log(`โ ๏ธ [CONNECTIVITY] API server responded with status: ${response.status}`);
|
|
276
|
+
}
|
|
277
|
+
} catch (apiError) {
|
|
278
|
+
results.api2Test = {
|
|
279
|
+
success: false,
|
|
280
|
+
error: apiError.message,
|
|
281
|
+
name: apiError.name
|
|
282
|
+
};
|
|
283
|
+
console.error('โ [CONNECTIVITY] Cannot reach API server:', apiError.message);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
// Determine overall result
|
|
287
|
+
if ((_results$api2Test = results.api2Test) !== null && _results$api2Test !== void 0 && _results$api2Test.success) {
|
|
288
|
+
return {
|
|
289
|
+
success: true,
|
|
290
|
+
message: 'API is reachable',
|
|
291
|
+
details: results
|
|
292
|
+
};
|
|
293
|
+
} else if ((_results$googleTest = results.googleTest) !== null && _results$googleTest !== void 0 && _results$googleTest.success) {
|
|
294
|
+
return {
|
|
295
|
+
success: false,
|
|
296
|
+
message: 'Internet works but API server is unreachable. The server may be blocking requests from this device/simulator.',
|
|
297
|
+
details: results
|
|
298
|
+
};
|
|
299
|
+
} else {
|
|
300
|
+
return {
|
|
301
|
+
success: false,
|
|
302
|
+
message: 'No internet connectivity detected. Check your network connection.',
|
|
303
|
+
details: results
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
} catch (error) {
|
|
307
|
+
console.error('โ [CONNECTIVITY] Connectivity test failed:', error.message);
|
|
308
|
+
return {
|
|
309
|
+
success: false,
|
|
310
|
+
message: `Network error: ${error.message}`,
|
|
311
|
+
details: {
|
|
312
|
+
error: error.message,
|
|
313
|
+
results
|
|
314
|
+
}
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
};
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* Initiate OAuth flow for a platform
|
|
321
|
+
* Uses User JWT for authentication (TIER 2)
|
|
322
|
+
*/
|
|
323
|
+
exports.testApiConnectivity = testApiConnectivity;
|
|
324
|
+
const initiateOAuth = async (platform, _username) => {
|
|
325
|
+
try {
|
|
326
|
+
console.log(`๐ [OAUTH] Starting OAuth for platform: ${platform}`);
|
|
327
|
+
console.log(`๐ฑ [OAUTH] Platform: ${_reactNative.Platform.OS}, Version: ${_reactNative.Platform.Version}`);
|
|
328
|
+
|
|
329
|
+
// For platforms that don't need OAuth (like email), handle differently
|
|
330
|
+
if (platform === 'email') {
|
|
331
|
+
console.log('๐ง [OAUTH] Email platform selected, returning mock auth URL');
|
|
332
|
+
return `${_api.API_CONFIG.BASE_URL}/email/authorize?action=verify`;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
// Get user JWT headers - user must be authenticated
|
|
336
|
+
let authHeaders;
|
|
337
|
+
try {
|
|
338
|
+
authHeaders = await (0, _api.getUserAuthHeaders)();
|
|
339
|
+
console.log(`๐ [OAUTH] Using User JWT for authentication`);
|
|
340
|
+
} catch (authError) {
|
|
341
|
+
console.error(`โ [OAUTH] User not authenticated - cannot initiate ${platform} OAuth`);
|
|
342
|
+
console.error(`โ [OAUTH] Please log in first before connecting platforms`);
|
|
343
|
+
return null;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
// Construct the proxy URL
|
|
347
|
+
const proxyUrl = `${_api.API_CONFIG.BASE_URL}/${platform}/authorize`;
|
|
348
|
+
console.log(`๐ [OAUTH] Proxy URL: ${proxyUrl}`);
|
|
349
|
+
console.log(`๐ [OAUTH] About to make fetch request...`);
|
|
350
|
+
|
|
351
|
+
// Request body - no username needed, backend extracts from JWT
|
|
352
|
+
const requestBody = {
|
|
353
|
+
platform: platform,
|
|
354
|
+
timestamp: new Date().toISOString()
|
|
355
|
+
};
|
|
356
|
+
console.log(`๐ค [OAUTH] Request body:`, requestBody);
|
|
357
|
+
|
|
358
|
+
// Add timeout to prevent hanging requests
|
|
359
|
+
const controller = new AbortController();
|
|
360
|
+
const timeoutId = setTimeout(() => {
|
|
361
|
+
console.log(`โฐ [OAUTH] Request timeout for ${platform} - aborting`);
|
|
362
|
+
controller.abort();
|
|
363
|
+
}, 30000); // 30 second timeout for simulator compatibility
|
|
364
|
+
|
|
365
|
+
// Make a POST request to the proxy
|
|
366
|
+
// ๐ SECURITY: Uses User JWT - backend extracts username from token
|
|
367
|
+
const response = await fetch(proxyUrl, {
|
|
368
|
+
method: 'POST',
|
|
369
|
+
headers: authHeaders,
|
|
370
|
+
body: JSON.stringify(requestBody),
|
|
371
|
+
signal: controller.signal
|
|
372
|
+
});
|
|
373
|
+
clearTimeout(timeoutId);
|
|
374
|
+
console.log(`๐ก [OAUTH] Response status: ${response.status} ${response.statusText}`);
|
|
375
|
+
if (!response.ok) {
|
|
376
|
+
const errorText = await response.text();
|
|
377
|
+
console.error(`โ [OAUTH] Error initiating OAuth for ${platform}: ${response.status} - ${errorText}`);
|
|
378
|
+
return null;
|
|
379
|
+
}
|
|
380
|
+
const data = await response.json();
|
|
381
|
+
console.log(`๐ [OAUTH] Response data for ${platform}:`, data);
|
|
382
|
+
|
|
383
|
+
// Get the authorization URL from the response
|
|
384
|
+
// Different platforms might use different keys (e.g., pinterestURL, youtubeURL)
|
|
385
|
+
const urlKey = `${platform}URL`;
|
|
386
|
+
const authUrl = data[urlKey] || data.url || null;
|
|
387
|
+
console.log(`๐ [OAUTH] Auth URL for ${platform} (key: ${urlKey}):`, authUrl);
|
|
388
|
+
return authUrl;
|
|
389
|
+
} catch (error) {
|
|
390
|
+
var _error$message;
|
|
391
|
+
// Enhanced error logging
|
|
392
|
+
if (error.name === 'AbortError') {
|
|
393
|
+
console.error(`โ [OAUTH] Request timeout for ${platform} - the server took too long to respond`);
|
|
394
|
+
} else if ((_error$message = error.message) !== null && _error$message !== void 0 && _error$message.includes('Network request failed')) {
|
|
395
|
+
console.error(`โ [OAUTH] Network request failed for ${platform}. Possible causes:`);
|
|
396
|
+
console.error(' 1. No internet connection on device/simulator');
|
|
397
|
+
console.error(' 2. API server (API server) is unreachable');
|
|
398
|
+
console.error(' 3. DNS resolution failed');
|
|
399
|
+
console.error(' 4. SSL/TLS certificate issue');
|
|
400
|
+
console.error(' 5. iOS simulator network sandbox issue - try on physical device');
|
|
401
|
+
} else {
|
|
402
|
+
console.error(`โ [OAUTH] Error initiating OAuth for ${platform}:`, error);
|
|
403
|
+
}
|
|
404
|
+
return null;
|
|
405
|
+
}
|
|
406
|
+
};
|
|
407
|
+
|
|
408
|
+
/**
|
|
409
|
+
* Initialize Google Sign-In configuration with enhanced refresh token support
|
|
410
|
+
* Updated with CRITICAL parameters for refresh token generation
|
|
411
|
+
*/
|
|
412
|
+
exports.initiateOAuth = initiateOAuth;
|
|
413
|
+
const initializeGoogleSignIn = () => {
|
|
414
|
+
_googleSignin.GoogleSignin.configure({
|
|
415
|
+
webClientId: WEB_CLIENT_ID,
|
|
416
|
+
// โ
CRITICAL: Web client ID for refresh tokens
|
|
417
|
+
iosClientId: IOS_CLIENT_ID,
|
|
418
|
+
// โ
iOS client ID for native auth
|
|
419
|
+
|
|
420
|
+
// ๐ CRITICAL: These parameters are REQUIRED for refresh tokens
|
|
421
|
+
offlineAccess: true,
|
|
422
|
+
// โ CRITICAL: Enables refresh tokens
|
|
423
|
+
forceCodeForRefreshToken: true,
|
|
424
|
+
// โ CRITICAL: Forces refresh token generation
|
|
425
|
+
|
|
426
|
+
// โ
Enhanced scopes for YouTube
|
|
427
|
+
scopes: ['https://www.googleapis.com/auth/youtube.readonly', 'openid', 'profile', 'email'],
|
|
428
|
+
// โ
Clear settings to avoid conflicts
|
|
429
|
+
hostedDomain: '',
|
|
430
|
+
accountName: ''
|
|
431
|
+
});
|
|
432
|
+
};
|
|
433
|
+
|
|
434
|
+
/**
|
|
435
|
+
* Force YouTube reconnection with consent screen to get refresh tokens
|
|
436
|
+
* This is the key function to fix YouTube token expiry issues
|
|
437
|
+
*/
|
|
438
|
+
const forceYouTubeReconnectionWithConsent = async username => {
|
|
439
|
+
try {
|
|
440
|
+
var _userInfo$data, _userInfo$data2, _userInfo$data3;
|
|
441
|
+
console.log('๐ FORCING fresh YouTube consent for refresh token...');
|
|
442
|
+
console.log('๐ค User:', username);
|
|
443
|
+
|
|
444
|
+
// Step 1: โ
CRITICAL: Complete sign out (clears all cached consent)
|
|
445
|
+
try {
|
|
446
|
+
await _googleSignin.GoogleSignin.signOut();
|
|
447
|
+
console.log('โ
Signed out - consent cache cleared');
|
|
448
|
+
} catch (signOutError) {
|
|
449
|
+
console.log('โน๏ธ Sign out not needed:', signOutError);
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
// Step 2: โ
CRITICAL: Clear cached tokens if available
|
|
453
|
+
try {
|
|
454
|
+
const existingTokens = await _googleSignin.GoogleSignin.getTokens();
|
|
455
|
+
if (existingTokens.accessToken) {
|
|
456
|
+
await _googleSignin.GoogleSignin.clearCachedAccessToken(existingTokens.accessToken);
|
|
457
|
+
console.log('โ
Token cache cleared');
|
|
458
|
+
}
|
|
459
|
+
} catch (clearError) {
|
|
460
|
+
console.log('โน๏ธ No token cache to clear');
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
// Step 3: โ
CRITICAL: Configure Google Sign-In for FORCED consent
|
|
464
|
+
console.log('๐ง Configuring Google Sign-In for forced consent...');
|
|
465
|
+
_googleSignin.GoogleSignin.configure({
|
|
466
|
+
webClientId: WEB_CLIENT_ID,
|
|
467
|
+
// โ
CRITICAL: Web client ID for refresh tokens
|
|
468
|
+
iosClientId: IOS_CLIENT_ID,
|
|
469
|
+
// โ
iOS client ID for native auth
|
|
470
|
+
|
|
471
|
+
// ๐ FORCE REFRESH TOKEN SETTINGS:
|
|
472
|
+
offlineAccess: true,
|
|
473
|
+
// Request offline access
|
|
474
|
+
forceCodeForRefreshToken: true,
|
|
475
|
+
// Force refresh token generation
|
|
476
|
+
|
|
477
|
+
// ๐ FORCE CONSENT SCREEN:
|
|
478
|
+
scopes: ['https://www.googleapis.com/auth/youtube.readonly', 'openid', 'profile', 'email'],
|
|
479
|
+
// โ
CRITICAL: Clear settings to force fresh consent
|
|
480
|
+
hostedDomain: '',
|
|
481
|
+
accountName: ''
|
|
482
|
+
});
|
|
483
|
+
|
|
484
|
+
// Step 4: โ
Check Play Services
|
|
485
|
+
await _googleSignin.GoogleSignin.hasPlayServices();
|
|
486
|
+
console.log('โ
Play Services available');
|
|
487
|
+
|
|
488
|
+
// Step 5: โ
CRITICAL: Sign in (this SHOULD show consent screen)
|
|
489
|
+
console.log('๐ Initiating sign-in - consent screen should appear...');
|
|
490
|
+
console.log('๐ฑ User should see: "Allow [App] to access your YouTube account when you\'re not using the app?"');
|
|
491
|
+
const userInfo = await _googleSignin.GoogleSignin.signIn();
|
|
492
|
+
console.log('โ
Sign-in completed - checking for refresh token...');
|
|
493
|
+
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);
|
|
494
|
+
|
|
495
|
+
// Step 6: โ
Get tokens after consent
|
|
496
|
+
const tokens = await _googleSignin.GoogleSignin.getTokens();
|
|
497
|
+
const currentUser = await _googleSignin.GoogleSignin.getCurrentUser();
|
|
498
|
+
console.log('๐ FULL userInfo object from forceYouTubeReconnectionWithConsent:');
|
|
499
|
+
console.log(JSON.stringify(userInfo, null, 2));
|
|
500
|
+
console.log('๐ FULL tokens object from forceYouTubeReconnectionWithConsent:');
|
|
501
|
+
console.log(JSON.stringify(tokens, null, 2));
|
|
502
|
+
console.log('๐ FULL currentUser object from forceYouTubeReconnectionWithConsent:');
|
|
503
|
+
console.log(JSON.stringify(currentUser, null, 2));
|
|
504
|
+
console.log('๐ Token analysis:');
|
|
505
|
+
console.log('- Access token:', tokens.accessToken ? `${tokens.accessToken.substring(0, 20)}...` : 'Missing');
|
|
506
|
+
console.log('- ID token:', tokens.idToken ? 'Present' : 'Missing');
|
|
507
|
+
console.log('- ServerAuthCode (userInfo):', (_userInfo$data2 = userInfo.data) !== null && _userInfo$data2 !== void 0 && _userInfo$data2.serverAuthCode ? `${userInfo.data.serverAuthCode.substring(0, 20)}...` : 'Missing');
|
|
508
|
+
console.log('- ServerAuthCode (currentUser):', currentUser !== null && currentUser !== void 0 && currentUser.serverAuthCode ? `${currentUser.serverAuthCode.substring(0, 20)}...` : 'Missing');
|
|
509
|
+
|
|
510
|
+
// Step 7: โ
Extract refresh capability
|
|
511
|
+
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);
|
|
512
|
+
if (refreshToken) {
|
|
513
|
+
var _userInfo$data0, _userInfo$data1, _userInfo$data10, _userInfo$data11, _userInfo$data12, _userInfo$data13;
|
|
514
|
+
console.log('โ
SUCCESS: Got refresh token after consent!');
|
|
515
|
+
console.log('๐ Refresh token type:', refreshToken.startsWith('4/') ? 'serverAuthCode' : 'refreshToken');
|
|
516
|
+
console.log('๐ Refresh token preview:', `${refreshToken.substring(0, 20)}...`);
|
|
517
|
+
|
|
518
|
+
// Step 8: โ
Get YouTube channel info
|
|
519
|
+
let channelName = 'Unknown Channel';
|
|
520
|
+
let channelId = null;
|
|
521
|
+
try {
|
|
522
|
+
console.log('๐บ Fetching YouTube channel information...');
|
|
523
|
+
const channelResponse = await fetch('https://www.googleapis.com/youtube/v3/channels?part=snippet&mine=true', {
|
|
524
|
+
headers: {
|
|
525
|
+
'Authorization': `Bearer ${tokens.accessToken}`,
|
|
526
|
+
'Accept': 'application/json'
|
|
527
|
+
}
|
|
528
|
+
});
|
|
529
|
+
if (channelResponse.ok) {
|
|
530
|
+
const channelData = await channelResponse.json();
|
|
531
|
+
if (channelData.items && channelData.items.length > 0) {
|
|
532
|
+
channelName = channelData.items[0].snippet.title;
|
|
533
|
+
channelId = channelData.items[0].id;
|
|
534
|
+
console.log('โ
YouTube channel found:', channelName, 'ID:', channelId);
|
|
535
|
+
} else {
|
|
536
|
+
var _userInfo$data4, _userInfo$data5;
|
|
537
|
+
console.log('โ ๏ธ No YouTube channel found for user');
|
|
538
|
+
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';
|
|
539
|
+
}
|
|
540
|
+
} else {
|
|
541
|
+
var _userInfo$data6, _userInfo$data7;
|
|
542
|
+
console.log('โ ๏ธ Failed to fetch YouTube channel info:', channelResponse.status);
|
|
543
|
+
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';
|
|
544
|
+
}
|
|
545
|
+
} catch (channelError) {
|
|
546
|
+
var _userInfo$data8, _userInfo$data9;
|
|
547
|
+
console.log('โ ๏ธ Error fetching YouTube channel info:', channelError);
|
|
548
|
+
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';
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
// Step 9: โ
Get authentication token using simplified JWT storage
|
|
552
|
+
let authToken = await (0, _jwtStorageService.getJWT)();
|
|
553
|
+
if (!authToken || authToken.trim().length < 20) {
|
|
554
|
+
console.log('๐ Creating authentication token for YouTube connection...');
|
|
555
|
+
// Create token logic here if needed
|
|
556
|
+
authToken = 'temp_token_for_youtube_connection';
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
// Step 10: โ
Send comprehensive data to backend
|
|
560
|
+
const backendPayload = {
|
|
561
|
+
session: {
|
|
562
|
+
username: username,
|
|
563
|
+
platform: 'youtube',
|
|
564
|
+
timestamp: new Date().toISOString(),
|
|
565
|
+
channelName: channelName,
|
|
566
|
+
channelId: channelId,
|
|
567
|
+
forceConsent: true // Flag to indicate this was forced consent
|
|
568
|
+
},
|
|
569
|
+
googleUser: (_userInfo$data0 = userInfo.data) === null || _userInfo$data0 === void 0 ? void 0 : _userInfo$data0.user,
|
|
570
|
+
accessToken: tokens.accessToken,
|
|
571
|
+
idToken: tokens.idToken,
|
|
572
|
+
refreshToken: refreshToken,
|
|
573
|
+
// โ
CRITICAL: The refresh token!
|
|
574
|
+
serverAuthCode: refreshToken,
|
|
575
|
+
// โ
Same as refresh token
|
|
576
|
+
|
|
577
|
+
// โ
CRITICAL: Additional compatibility fields for backend
|
|
578
|
+
refresh_token: refreshToken,
|
|
579
|
+
// Snake case version
|
|
580
|
+
server_auth_code: refreshToken,
|
|
581
|
+
// Snake case version
|
|
582
|
+
authCode: refreshToken,
|
|
583
|
+
// Alternative naming
|
|
584
|
+
|
|
585
|
+
userAccountInfo: {
|
|
586
|
+
username: username,
|
|
587
|
+
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,
|
|
588
|
+
authToken: authToken,
|
|
589
|
+
channelName: channelName,
|
|
590
|
+
channelId: channelId,
|
|
591
|
+
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}`,
|
|
592
|
+
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,
|
|
593
|
+
// โ
CRITICAL: Also include refresh token in userAccountInfo
|
|
594
|
+
refreshToken: refreshToken,
|
|
595
|
+
serverAuthCode: refreshToken
|
|
596
|
+
},
|
|
597
|
+
tokenExpiry: new Date(Date.now() + 3600 * 1000).toISOString(),
|
|
598
|
+
// 1 hour from now
|
|
599
|
+
requestRefreshToken: true,
|
|
600
|
+
debugInfo: {
|
|
601
|
+
hasRefreshToken: true,
|
|
602
|
+
refreshTokenType: refreshToken.startsWith('4/') ? 'serverAuthCode' : 'refreshToken',
|
|
603
|
+
configuredForRefresh: true,
|
|
604
|
+
forcedConsent: true,
|
|
605
|
+
consentMethod: 'signOut_and_configure',
|
|
606
|
+
refreshTokenValue: refreshToken // Include actual value for debugging
|
|
607
|
+
}
|
|
608
|
+
};
|
|
609
|
+
console.log('๐ค Sending comprehensive payload with REFRESH TOKEN to backend:', {
|
|
610
|
+
hasAccessToken: !!backendPayload.accessToken,
|
|
611
|
+
hasRefreshToken: !!backendPayload.refreshToken,
|
|
612
|
+
hasServerAuthCode: !!backendPayload.serverAuthCode,
|
|
613
|
+
refreshTokenType: backendPayload.debugInfo.refreshTokenType,
|
|
614
|
+
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,
|
|
615
|
+
forcedConsent: true
|
|
616
|
+
});
|
|
617
|
+
|
|
618
|
+
// Step 11: โ
Send to backend with ENHANCED LOGGING
|
|
619
|
+
console.log('๐ [YOUTUBE REAUTH] ===== SENDING REAUTH SIGNAL TO BACKEND =====');
|
|
620
|
+
console.log('๐ [YOUTUBE REAUTH] Endpoint: https://API server/youtube/native-auth');
|
|
621
|
+
console.log('๐ [YOUTUBE REAUTH] Method: POST');
|
|
622
|
+
console.log('๐ [YOUTUBE REAUTH] Headers:', {
|
|
623
|
+
'Content-Type': 'application/json',
|
|
624
|
+
'Authorization': authToken ? `${authToken.substring(0, 20)}...` : 'NO AUTH TOKEN'
|
|
625
|
+
});
|
|
626
|
+
console.log('๐ [YOUTUBE REAUTH] Payload Summary:', {
|
|
627
|
+
hasAccessToken: !!backendPayload.accessToken,
|
|
628
|
+
hasRefreshToken: !!backendPayload.refreshToken,
|
|
629
|
+
hasServerAuthCode: !!backendPayload.serverAuthCode,
|
|
630
|
+
refreshTokenType: backendPayload.debugInfo.refreshTokenType,
|
|
631
|
+
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,
|
|
632
|
+
channelName: channelName,
|
|
633
|
+
forcedConsent: true,
|
|
634
|
+
requestRefreshToken: true
|
|
635
|
+
});
|
|
636
|
+
console.log('๐ [YOUTUBE REAUTH] FULL PAYLOAD:', JSON.stringify(backendPayload, null, 2));
|
|
637
|
+
const backendResponse = await fetch(`${_api.API_CONFIG.BASE_URL}/youtube/native-auth`, {
|
|
638
|
+
method: 'POST',
|
|
639
|
+
headers: {
|
|
640
|
+
'Content-Type': 'application/json',
|
|
641
|
+
...(authToken && {
|
|
642
|
+
'Authorization': authToken
|
|
643
|
+
})
|
|
644
|
+
},
|
|
645
|
+
body: JSON.stringify(backendPayload)
|
|
646
|
+
});
|
|
647
|
+
console.log('๐ก [YOUTUBE REAUTH] Response Status:', backendResponse.status);
|
|
648
|
+
console.log('๐ก [YOUTUBE REAUTH] Response Status Text:', backendResponse.statusText);
|
|
649
|
+
console.log('๐ก [YOUTUBE REAUTH] Response Headers:', backendResponse.headers);
|
|
650
|
+
if (backendResponse.ok) {
|
|
651
|
+
var _responseData$validat, _responseData$tempora;
|
|
652
|
+
const responseData = await backendResponse.json();
|
|
653
|
+
console.log('โ
[YOUTUBE REAUTH] Backend Response SUCCESS:', JSON.stringify(responseData, null, 2));
|
|
654
|
+
|
|
655
|
+
// Enhanced verification with detailed logging and temporary mode detection (exact backend fields)
|
|
656
|
+
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');
|
|
657
|
+
if (isTemporaryMode) {
|
|
658
|
+
console.log('๐ [YOUTUBE REAUTH] YouTube connected in temporary mode');
|
|
659
|
+
console.log('โ
[YOUTUBE REAUTH] Training will work, but connection expires in ~1 hour');
|
|
660
|
+
console.log('๐ [YOUTUBE REAUTH] SUCCESS: Temporary YouTube connection established!');
|
|
661
|
+
console.log('๐ [YOUTUBE REAUTH] Connection Details:');
|
|
662
|
+
console.log('๐ [YOUTUBE REAUTH] Mode: Temporary (expires ~1 hour)');
|
|
663
|
+
console.log('๐ [YOUTUBE REAUTH] Training Ready: Yes');
|
|
664
|
+
console.log('๐ [YOUTUBE REAUTH] Refresh token sent:', refreshToken ? 'Yes' : 'No');
|
|
665
|
+
} else if (responseData.hasRefreshToken || responseData.refreshTokenReceived) {
|
|
666
|
+
console.log('โ
[YOUTUBE REAUTH] Backend CONFIRMED refresh token received');
|
|
667
|
+
console.log('โ
[YOUTUBE REAUTH] Response hasRefreshToken:', responseData.hasRefreshToken);
|
|
668
|
+
console.log('๐ [YOUTUBE REAUTH] SUCCESS: Full YouTube connection with refresh tokens!');
|
|
669
|
+
|
|
670
|
+
// CRITICAL: Print the refresh token that was sent for debugging
|
|
671
|
+
console.log('๐ [YOUTUBE REAUTH] REFRESH TOKEN SENT TO BACKEND:');
|
|
672
|
+
console.log('๐ [YOUTUBE REAUTH] Full refresh token:', refreshToken);
|
|
673
|
+
console.log('๐ [YOUTUBE REAUTH] Refresh token type:', refreshToken.startsWith('4/') ? 'serverAuthCode' : 'refreshToken');
|
|
674
|
+
console.log('๐ [YOUTUBE REAUTH] Refresh token length:', refreshToken.length);
|
|
675
|
+
} else {
|
|
676
|
+
console.warn('โ ๏ธ [YOUTUBE REAUTH] Backend did NOT confirm refresh token reception');
|
|
677
|
+
console.warn('โ ๏ธ [YOUTUBE REAUTH] Response data:', responseData);
|
|
678
|
+
console.warn('โ ๏ธ [YOUTUBE REAUTH] Expected hasRefreshToken or refreshTokenReceived in response');
|
|
679
|
+
return false;
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
// CRITICAL: Signal training system to restart with new connection
|
|
683
|
+
console.log('๐ [YOUTUBE REAUTH] Signaling training system to restart...');
|
|
684
|
+
try {
|
|
685
|
+
await triggerTrainingRestart(username, authToken);
|
|
686
|
+
console.log('โ
[YOUTUBE REAUTH] Training restart signal sent successfully');
|
|
687
|
+
} catch (restartError) {
|
|
688
|
+
console.warn('โ ๏ธ [YOUTUBE REAUTH] Training restart signal failed:', restartError);
|
|
689
|
+
console.warn('โ ๏ธ [YOUTUBE REAUTH] User may need to manually restart training');
|
|
690
|
+
}
|
|
691
|
+
return true;
|
|
692
|
+
} else {
|
|
693
|
+
const errorData = await backendResponse.text();
|
|
694
|
+
console.error('โ [YOUTUBE REAUTH] Backend processing FAILED:', backendResponse.status, errorData);
|
|
695
|
+
console.error('โ [YOUTUBE REAUTH] This means the reauth signal was not processed');
|
|
696
|
+
return false;
|
|
697
|
+
}
|
|
698
|
+
} else {
|
|
699
|
+
console.error('โ CRITICAL: No refresh token even after consent screen');
|
|
700
|
+
console.error('โ This means consent screen did not appear or user denied permissions');
|
|
701
|
+
console.error('๐ก Solutions:');
|
|
702
|
+
console.error(' 1. Try the revoke method: forceYouTubeReconnectionWithRevoke()');
|
|
703
|
+
console.error(' 2. Check Google Console OAuth configuration');
|
|
704
|
+
console.error(' 3. Ensure user clicks "Allow" on consent screen');
|
|
705
|
+
return false;
|
|
706
|
+
}
|
|
707
|
+
} catch (error) {
|
|
708
|
+
console.error('โ Error forcing YouTube consent:', error);
|
|
709
|
+
if (error.code === _googleSignin.statusCodes.SIGN_IN_CANCELLED) {
|
|
710
|
+
console.error('โ User cancelled sign-in - no refresh token obtained');
|
|
711
|
+
console.error('๐ก User must click "Allow" to get refresh token');
|
|
712
|
+
} else if (error.code === _googleSignin.statusCodes.IN_PROGRESS) {
|
|
713
|
+
console.error('โ Sign-in already in progress');
|
|
714
|
+
} else if (error.code === _googleSignin.statusCodes.PLAY_SERVICES_NOT_AVAILABLE) {
|
|
715
|
+
console.error('โ Google Play Services not available');
|
|
716
|
+
}
|
|
717
|
+
return false;
|
|
718
|
+
}
|
|
719
|
+
};
|
|
720
|
+
|
|
721
|
+
/**
|
|
722
|
+
* Alternative method: Force consent by revoking existing permissions
|
|
723
|
+
*/
|
|
724
|
+
exports.forceYouTubeReconnectionWithConsent = forceYouTubeReconnectionWithConsent;
|
|
725
|
+
const forceYouTubeReconnectionWithRevoke = async username => {
|
|
726
|
+
try {
|
|
727
|
+
var _userInfo$data14;
|
|
728
|
+
console.log('๐ FORCING YouTube consent via REVOKE method...');
|
|
729
|
+
console.log('๐ค User:', username);
|
|
730
|
+
|
|
731
|
+
// Step 1: Initialize Google Sign-In
|
|
732
|
+
initializeGoogleSignIn();
|
|
733
|
+
await _googleSignin.GoogleSignin.hasPlayServices();
|
|
734
|
+
|
|
735
|
+
// Step 2: โ
CRITICAL: Revoke existing permissions (forces fresh consent)
|
|
736
|
+
try {
|
|
737
|
+
await _googleSignin.GoogleSignin.revokeAccess();
|
|
738
|
+
console.log('โ
Revoked existing permissions - fresh consent REQUIRED');
|
|
739
|
+
} catch (revokeError) {
|
|
740
|
+
console.log('โน๏ธ No existing permissions to revoke:', revokeError);
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
// Step 3: Sign out completely
|
|
744
|
+
await _googleSignin.GoogleSignin.signOut();
|
|
745
|
+
console.log('โ
Signed out completely');
|
|
746
|
+
|
|
747
|
+
// Step 4: โ
Now sign in again (will DEFINITELY show consent screen)
|
|
748
|
+
console.log('๐ Signing in after revoke - consent screen MUST appear...');
|
|
749
|
+
const userInfo = await _googleSignin.GoogleSignin.signIn();
|
|
750
|
+
|
|
751
|
+
// Step 5: โ
User will definitely see consent screen now
|
|
752
|
+
const tokens = await _googleSignin.GoogleSignin.getTokens();
|
|
753
|
+
const currentUser = await _googleSignin.GoogleSignin.getCurrentUser();
|
|
754
|
+
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);
|
|
755
|
+
if (refreshToken) {
|
|
756
|
+
console.log('โ
SUCCESS: Got refresh token after REVOKE + consent!');
|
|
757
|
+
console.log('๐ Refresh token preview:', `${refreshToken.substring(0, 20)}...`);
|
|
758
|
+
|
|
759
|
+
// Continue with the same backend submission logic as above
|
|
760
|
+
// (Similar to forceYouTubeReconnectionWithConsent)
|
|
761
|
+
|
|
762
|
+
return true;
|
|
763
|
+
} else {
|
|
764
|
+
console.error('โ Still no refresh token after revoke method');
|
|
765
|
+
return false;
|
|
766
|
+
}
|
|
767
|
+
} catch (error) {
|
|
768
|
+
console.error('โ Error with revoke method:', error);
|
|
769
|
+
return false;
|
|
770
|
+
}
|
|
771
|
+
};
|
|
772
|
+
|
|
773
|
+
/**
|
|
774
|
+
* Fix YouTube connection for a specific user (like nicholase50)
|
|
775
|
+
*/
|
|
776
|
+
exports.forceYouTubeReconnectionWithRevoke = forceYouTubeReconnectionWithRevoke;
|
|
777
|
+
const fixUserYouTubeConnection = async username => {
|
|
778
|
+
console.log(`๐ง Fixing YouTube connection for user: ${username}`);
|
|
779
|
+
|
|
780
|
+
// Method 1: Try forced consent via configuration
|
|
781
|
+
console.log('๐ Method 1: Trying forced consent via configuration...');
|
|
782
|
+
let success = await forceYouTubeReconnectionWithConsent(username);
|
|
783
|
+
if (success) {
|
|
784
|
+
console.log(`โ
${username} YouTube connection fixed via Method 1!`);
|
|
785
|
+
return true;
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
// Method 2: Try forced consent via revoke
|
|
789
|
+
console.log('๐ Method 2: Trying forced consent via revoke...');
|
|
790
|
+
success = await forceYouTubeReconnectionWithRevoke(username);
|
|
791
|
+
if (success) {
|
|
792
|
+
console.log(`โ
${username} YouTube connection fixed via Method 2!`);
|
|
793
|
+
return true;
|
|
794
|
+
}
|
|
795
|
+
console.error(`โ Failed to fix ${username} YouTube connection with both methods`);
|
|
796
|
+
return false;
|
|
797
|
+
};
|
|
798
|
+
|
|
799
|
+
/**
|
|
800
|
+
* Get fresh tokens using refresh token
|
|
801
|
+
*/
|
|
802
|
+
exports.fixUserYouTubeConnection = fixUserYouTubeConnection;
|
|
803
|
+
const refreshGoogleTokens = async () => {
|
|
804
|
+
try {
|
|
805
|
+
console.log('๐ Attempting to refresh Google tokens...');
|
|
806
|
+
|
|
807
|
+
// Check if user is signed in
|
|
808
|
+
const currentUser = await _googleSignin.GoogleSignin.getCurrentUser();
|
|
809
|
+
if (!currentUser) {
|
|
810
|
+
console.log('โ User not signed in to Google, cannot refresh tokens');
|
|
811
|
+
return null;
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
// Get fresh tokens
|
|
815
|
+
const tokens = await _googleSignin.GoogleSignin.getTokens();
|
|
816
|
+
console.log('โ
Successfully refreshed Google tokens');
|
|
817
|
+
return {
|
|
818
|
+
accessToken: tokens.accessToken,
|
|
819
|
+
idToken: tokens.idToken
|
|
820
|
+
};
|
|
821
|
+
} catch (error) {
|
|
822
|
+
console.error('โ Failed to refresh Google tokens:', error);
|
|
823
|
+
|
|
824
|
+
// If refresh fails, try to sign in again
|
|
825
|
+
try {
|
|
826
|
+
console.log('๐ Refresh failed, attempting re-authentication...');
|
|
827
|
+
const userInfo = await _googleSignin.GoogleSignin.signIn();
|
|
828
|
+
const tokens = await _googleSignin.GoogleSignin.getTokens();
|
|
829
|
+
console.log('โ
Re-authentication successful');
|
|
830
|
+
return {
|
|
831
|
+
accessToken: tokens.accessToken,
|
|
832
|
+
idToken: tokens.idToken
|
|
833
|
+
};
|
|
834
|
+
} catch (signInError) {
|
|
835
|
+
console.error('โ Re-authentication also failed:', signInError);
|
|
836
|
+
return null;
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
};
|
|
840
|
+
|
|
841
|
+
/**
|
|
842
|
+
* Debug YouTube tokens to verify refresh token availability
|
|
843
|
+
*/
|
|
844
|
+
const debugYouTubeTokens = async () => {
|
|
845
|
+
try {
|
|
846
|
+
var _currentUser$user;
|
|
847
|
+
const tokens = await _googleSignin.GoogleSignin.getTokens();
|
|
848
|
+
const currentUser = await _googleSignin.GoogleSignin.getCurrentUser();
|
|
849
|
+
console.log('๐ YouTube Token Debug:', {
|
|
850
|
+
accessToken: tokens.accessToken ? `${tokens.accessToken.substring(0, 20)}...` : 'Missing',
|
|
851
|
+
idToken: tokens.idToken ? 'Present' : 'Missing',
|
|
852
|
+
serverAuthCode: currentUser !== null && currentUser !== void 0 && currentUser.serverAuthCode ? `${currentUser.serverAuthCode.substring(0, 20)}...` : 'Missing',
|
|
853
|
+
userEmail: (currentUser === null || currentUser === void 0 || (_currentUser$user = currentUser.user) === null || _currentUser$user === void 0 ? void 0 : _currentUser$user.email) || 'Missing'
|
|
854
|
+
});
|
|
855
|
+
return {
|
|
856
|
+
hasRefreshToken: !!(currentUser !== null && currentUser !== void 0 && currentUser.serverAuthCode),
|
|
857
|
+
refreshTokenType: currentUser !== null && currentUser !== void 0 && currentUser.serverAuthCode ? 'serverAuthCode' : 'none'
|
|
858
|
+
};
|
|
859
|
+
} catch (error) {
|
|
860
|
+
console.error('โ Debug tokens failed:', error);
|
|
861
|
+
return {
|
|
862
|
+
hasRefreshToken: false,
|
|
863
|
+
refreshTokenType: 'error'
|
|
864
|
+
};
|
|
865
|
+
}
|
|
866
|
+
};
|
|
867
|
+
|
|
868
|
+
/**
|
|
869
|
+
* Force fresh YouTube reconnection with proper refresh token
|
|
870
|
+
*/
|
|
871
|
+
const reconnectYouTube = async username => {
|
|
872
|
+
try {
|
|
873
|
+
console.log('๐ Forcing fresh YouTube reconnection for refresh token...');
|
|
874
|
+
|
|
875
|
+
// 1. Sign out completely to force fresh consent
|
|
876
|
+
try {
|
|
877
|
+
await _googleSignin.GoogleSignin.signOut();
|
|
878
|
+
console.log('โ
Signed out from Google');
|
|
879
|
+
} catch (signOutError) {
|
|
880
|
+
console.log('โน๏ธ Already signed out or sign out failed:', signOutError);
|
|
881
|
+
}
|
|
882
|
+
|
|
883
|
+
// 2. Clear any cached tokens
|
|
884
|
+
try {
|
|
885
|
+
const currentTokens = await _googleSignin.GoogleSignin.getTokens();
|
|
886
|
+
if (currentTokens.accessToken) {
|
|
887
|
+
await _googleSignin.GoogleSignin.clearCachedAccessToken(currentTokens.accessToken);
|
|
888
|
+
console.log('โ
Cleared cached access token');
|
|
889
|
+
}
|
|
890
|
+
} catch (clearError) {
|
|
891
|
+
console.log('โน๏ธ Token clearing failed or not needed:', clearError);
|
|
892
|
+
}
|
|
893
|
+
|
|
894
|
+
// 3. Re-authenticate with fresh consent
|
|
895
|
+
const result = await initiateNativeAuth('youtube', username);
|
|
896
|
+
if (result) {
|
|
897
|
+
console.log('โ
YouTube reconnected successfully with refresh token');
|
|
898
|
+
|
|
899
|
+
// 4. Verify we now have a refresh token
|
|
900
|
+
const debugInfo = await debugYouTubeTokens();
|
|
901
|
+
if (debugInfo.hasRefreshToken) {
|
|
902
|
+
console.log('โ
Refresh token confirmed:', debugInfo.refreshTokenType);
|
|
903
|
+
} else {
|
|
904
|
+
console.warn('โ ๏ธ Still no refresh token after reconnection');
|
|
905
|
+
}
|
|
906
|
+
return true;
|
|
907
|
+
} else {
|
|
908
|
+
console.error('โ YouTube reconnection failed');
|
|
909
|
+
return false;
|
|
910
|
+
}
|
|
911
|
+
} catch (error) {
|
|
912
|
+
console.error('โ YouTube reconnection error:', error);
|
|
913
|
+
return false;
|
|
914
|
+
}
|
|
915
|
+
};
|
|
916
|
+
|
|
917
|
+
/**
|
|
918
|
+
* Initiate native authentication for platforms with SDKs
|
|
919
|
+
*/
|
|
920
|
+
exports.reconnectYouTube = reconnectYouTube;
|
|
921
|
+
const initiateNativeAuth = async (platform, username) => {
|
|
922
|
+
if (platform === 'youtube') {
|
|
923
|
+
console.log('๐ Initiating native Google Sign-In for YouTube');
|
|
924
|
+
|
|
925
|
+
// Validate username for YouTube
|
|
926
|
+
if (!username || username.trim() === '') {
|
|
927
|
+
console.error('โ [YOUTUBE AUTH] Username is required for YouTube authentication');
|
|
928
|
+
return false;
|
|
929
|
+
}
|
|
930
|
+
try {
|
|
931
|
+
var _userInfo$data15, _currentUser$user2, _userInfo$data16, _userInfo$data17, _userInfo$data24, _userInfo$data25, _userInfo$data26, _userInfo$data27, _userInfo$data28, _userInfo$data29;
|
|
932
|
+
// Initialize Google Sign-In if not already done
|
|
933
|
+
// โ
CRITICAL: Initialize with CORRECT iOS Client ID
|
|
934
|
+
initializeGoogleSignIn();
|
|
935
|
+
|
|
936
|
+
// Check if Google Play Services are available
|
|
937
|
+
await _googleSignin.GoogleSignin.hasPlayServices();
|
|
938
|
+
|
|
939
|
+
// โ
CRITICAL: Force sign out first to ensure fresh consent
|
|
940
|
+
try {
|
|
941
|
+
await _googleSignin.GoogleSignin.signOut();
|
|
942
|
+
console.log('๐ Signed out to force fresh consent');
|
|
943
|
+
} catch (signOutError) {
|
|
944
|
+
console.log('โน๏ธ Sign out not needed or failed:', signOutError);
|
|
945
|
+
}
|
|
946
|
+
|
|
947
|
+
// Sign in with Google (this will show consent screen due to our config)
|
|
948
|
+
const userInfo = await _googleSignin.GoogleSignin.signIn();
|
|
949
|
+
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);
|
|
950
|
+
console.log('๐ FULL userInfo object:');
|
|
951
|
+
console.log(JSON.stringify(userInfo, null, 2));
|
|
952
|
+
|
|
953
|
+
// Get access token for API calls
|
|
954
|
+
const tokens = await _googleSignin.GoogleSignin.getTokens();
|
|
955
|
+
console.log('๐ Got Google tokens');
|
|
956
|
+
console.log('๐ FULL tokens object:');
|
|
957
|
+
console.log(JSON.stringify(tokens, null, 2));
|
|
958
|
+
|
|
959
|
+
// CRITICAL: Get the current user info which contains the refresh token
|
|
960
|
+
const currentUser = await _googleSignin.GoogleSignin.getCurrentUser();
|
|
961
|
+
console.log('๐ค Current user info:', currentUser === null || currentUser === void 0 || (_currentUser$user2 = currentUser.user) === null || _currentUser$user2 === void 0 ? void 0 : _currentUser$user2.email);
|
|
962
|
+
console.log('๐ FULL currentUser object:');
|
|
963
|
+
console.log(JSON.stringify(currentUser, null, 2));
|
|
964
|
+
|
|
965
|
+
// โ
CRITICAL: Extract refresh token properly using serverAuthCode
|
|
966
|
+
let refreshToken = null;
|
|
967
|
+
console.log('๐ REFRESH TOKEN EXTRACTION:');
|
|
968
|
+
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');
|
|
969
|
+
console.log('- currentUser?.serverAuthCode:', currentUser !== null && currentUser !== void 0 && currentUser.serverAuthCode ? `Present: ${currentUser.serverAuthCode.substring(0, 20)}...` : 'Missing');
|
|
970
|
+
console.log('- tokens.idToken:', tokens.idToken ? `Present: ${tokens.idToken.substring(0, 20)}...` : 'Missing');
|
|
971
|
+
console.log('- tokens.accessToken:', tokens.accessToken ? `Present: ${tokens.accessToken.substring(0, 20)}...` : 'Missing');
|
|
972
|
+
|
|
973
|
+
// The serverAuthCode is the refresh token mechanism for React Native Google Sign-In
|
|
974
|
+
if (currentUser !== null && currentUser !== void 0 && currentUser.serverAuthCode) {
|
|
975
|
+
refreshToken = currentUser.serverAuthCode;
|
|
976
|
+
console.log('โ
Got serverAuthCode (refresh token mechanism)');
|
|
977
|
+
console.log('๐ Refresh token preview:', `${refreshToken.substring(0, 20)}...`);
|
|
978
|
+
} else if ((_userInfo$data17 = userInfo.data) !== null && _userInfo$data17 !== void 0 && _userInfo$data17.serverAuthCode) {
|
|
979
|
+
refreshToken = userInfo.data.serverAuthCode;
|
|
980
|
+
console.log('โ
Got serverAuthCode from sign-in response');
|
|
981
|
+
console.log('๐ Refresh token preview:', `${refreshToken.substring(0, 20)}...`);
|
|
982
|
+
}
|
|
983
|
+
|
|
984
|
+
// โ
CRITICAL: Verify refresh token availability
|
|
985
|
+
if (!refreshToken) {
|
|
986
|
+
console.error('โ CRITICAL: No refresh token available - YouTube connection will fail when token expires');
|
|
987
|
+
console.error('๐ก User needs to reconnect with proper consent screen');
|
|
988
|
+
console.error('๐ก Check Google Sign-In configuration: offlineAccess, forceCodeForRefreshToken');
|
|
989
|
+
|
|
990
|
+
// Still continue but warn about the issue
|
|
991
|
+
console.warn('โ ๏ธ Continuing without refresh token - connection may fail later');
|
|
992
|
+
} else {
|
|
993
|
+
console.log('โ
Refresh token available for YouTube connection');
|
|
994
|
+
console.log('๐ Refresh token type:', refreshToken.startsWith('4/') ? 'serverAuthCode' : 'refreshToken');
|
|
995
|
+
}
|
|
996
|
+
|
|
997
|
+
// Fetch YouTube channel information using the access token
|
|
998
|
+
let channelName = 'Unknown Channel';
|
|
999
|
+
let channelId = null;
|
|
1000
|
+
try {
|
|
1001
|
+
console.log('๐บ Fetching YouTube channel information...');
|
|
1002
|
+
const channelResponse = await fetch('https://www.googleapis.com/youtube/v3/channels?part=snippet&mine=true', {
|
|
1003
|
+
headers: {
|
|
1004
|
+
'Authorization': `Bearer ${tokens.accessToken}`,
|
|
1005
|
+
'Accept': 'application/json'
|
|
1006
|
+
}
|
|
1007
|
+
});
|
|
1008
|
+
if (channelResponse.ok) {
|
|
1009
|
+
const channelData = await channelResponse.json();
|
|
1010
|
+
if (channelData.items && channelData.items.length > 0) {
|
|
1011
|
+
channelName = channelData.items[0].snippet.title;
|
|
1012
|
+
channelId = channelData.items[0].id;
|
|
1013
|
+
console.log('โ
YouTube channel found:', channelName, 'ID:', channelId);
|
|
1014
|
+
} else {
|
|
1015
|
+
var _userInfo$data18, _userInfo$data19;
|
|
1016
|
+
console.log('โ ๏ธ No YouTube channel found for user');
|
|
1017
|
+
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';
|
|
1018
|
+
}
|
|
1019
|
+
} else {
|
|
1020
|
+
var _userInfo$data20, _userInfo$data21;
|
|
1021
|
+
console.log('โ ๏ธ Failed to fetch YouTube channel info:', channelResponse.status);
|
|
1022
|
+
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';
|
|
1023
|
+
}
|
|
1024
|
+
} catch (channelError) {
|
|
1025
|
+
var _userInfo$data22, _userInfo$data23;
|
|
1026
|
+
console.log('โ ๏ธ Error fetching YouTube channel info:', channelError);
|
|
1027
|
+
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';
|
|
1028
|
+
}
|
|
1029
|
+
|
|
1030
|
+
// Get stored authentication info to link YouTube data to user account
|
|
1031
|
+
// NOTE: SDK no longer creates EnochUser - consuming app should handle this
|
|
1032
|
+
let authToken = await (0, _jwtStorageService.getJWT)();
|
|
1033
|
+
const storedUsername = await _asyncStorage.default.getItem('onairos_username');
|
|
1034
|
+
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';
|
|
1035
|
+
|
|
1036
|
+
// Log authentication status - SDK does NOT create users during YouTube connection
|
|
1037
|
+
if (!authToken || authToken.trim().length < 20) {
|
|
1038
|
+
console.log('โน๏ธ No valid authentication token found for YouTube connection');
|
|
1039
|
+
console.log('โน๏ธ NOTE: SDK does not create users during YouTube connection');
|
|
1040
|
+
console.log('โน๏ธ User should authenticate first via Google/Apple/Email before connecting YouTube');
|
|
1041
|
+
// Continue without token - YouTube connection will work but may not be linked to user
|
|
1042
|
+
} else {
|
|
1043
|
+
console.log('โ
Found existing authentication token for YouTube auth');
|
|
1044
|
+
console.log('๐ Token preview:', `${authToken.substring(0, 20)}...`);
|
|
1045
|
+
}
|
|
1046
|
+
console.log('๐ Linking YouTube data to user:', finalUsername);
|
|
1047
|
+
console.log('๐ Using auth token for linking:', authToken ? `${authToken.substring(0, 20)}...` : 'No token');
|
|
1048
|
+
console.log('๐บ YouTube channel name:', channelName);
|
|
1049
|
+
|
|
1050
|
+
// โ
CRITICAL: Enhanced payload with comprehensive refresh token data
|
|
1051
|
+
const backendPayload = {
|
|
1052
|
+
session: {
|
|
1053
|
+
username: finalUsername,
|
|
1054
|
+
platform: 'youtube',
|
|
1055
|
+
timestamp: new Date().toISOString(),
|
|
1056
|
+
channelName: channelName,
|
|
1057
|
+
channelId: channelId
|
|
1058
|
+
},
|
|
1059
|
+
googleUser: (_userInfo$data25 = userInfo.data) === null || _userInfo$data25 === void 0 ? void 0 : _userInfo$data25.user,
|
|
1060
|
+
accessToken: tokens.accessToken,
|
|
1061
|
+
idToken: tokens.idToken,
|
|
1062
|
+
refreshToken: refreshToken,
|
|
1063
|
+
// โ
CRITICAL: Include refresh token
|
|
1064
|
+
serverAuthCode: refreshToken,
|
|
1065
|
+
// โ
Alternative refresh mechanism (same as refreshToken)
|
|
1066
|
+
|
|
1067
|
+
// โ
CRITICAL: Additional compatibility fields for backend
|
|
1068
|
+
refresh_token: refreshToken,
|
|
1069
|
+
// Snake case version
|
|
1070
|
+
server_auth_code: refreshToken,
|
|
1071
|
+
// Snake case version
|
|
1072
|
+
authCode: refreshToken,
|
|
1073
|
+
// Alternative naming
|
|
1074
|
+
|
|
1075
|
+
// Include user account linking information
|
|
1076
|
+
userAccountInfo: {
|
|
1077
|
+
username: finalUsername,
|
|
1078
|
+
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,
|
|
1079
|
+
authToken: authToken,
|
|
1080
|
+
channelName: channelName,
|
|
1081
|
+
channelId: channelId,
|
|
1082
|
+
// CRITICAL: Include user identifier that matches your database
|
|
1083
|
+
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}`,
|
|
1084
|
+
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,
|
|
1085
|
+
appleUserId: authToken !== null && authToken !== void 0 && authToken.includes('apple') ? authToken.split('.')[1] : null,
|
|
1086
|
+
// โ
CRITICAL: Also include refresh token in userAccountInfo
|
|
1087
|
+
refreshToken: refreshToken,
|
|
1088
|
+
serverAuthCode: refreshToken
|
|
1089
|
+
},
|
|
1090
|
+
// Token expiry information
|
|
1091
|
+
tokenExpiry: new Date(Date.now() + 3600 * 1000).toISOString(),
|
|
1092
|
+
// 1 hour from now
|
|
1093
|
+
// Force refresh token request
|
|
1094
|
+
requestRefreshToken: true,
|
|
1095
|
+
// โ
CRITICAL: Debug information for backend
|
|
1096
|
+
debugInfo: {
|
|
1097
|
+
hasRefreshToken: !!refreshToken,
|
|
1098
|
+
refreshTokenType: refreshToken ? refreshToken.startsWith('4/') ? 'serverAuthCode' : 'refreshToken' : 'none',
|
|
1099
|
+
configuredForRefresh: true,
|
|
1100
|
+
forcedConsent: true,
|
|
1101
|
+
refreshTokenValue: refreshToken // Include actual value for debugging
|
|
1102
|
+
}
|
|
1103
|
+
};
|
|
1104
|
+
console.log('๐ค BACKEND PAYLOAD SUMMARY:');
|
|
1105
|
+
console.log('- hasAccessToken:', !!backendPayload.accessToken);
|
|
1106
|
+
console.log('- hasRefreshToken:', !!backendPayload.refreshToken);
|
|
1107
|
+
console.log('- hasServerAuthCode:', !!backendPayload.serverAuthCode);
|
|
1108
|
+
console.log('- refreshTokenType:', backendPayload.debugInfo.refreshTokenType);
|
|
1109
|
+
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);
|
|
1110
|
+
console.log('- channelName:', channelName);
|
|
1111
|
+
console.log('๐ COMPLETE BACKEND PAYLOAD:');
|
|
1112
|
+
console.log(JSON.stringify(backendPayload, null, 2));
|
|
1113
|
+
|
|
1114
|
+
// Send the tokens to your backend for YouTube data processing with ENHANCED LOGGING
|
|
1115
|
+
console.log('๐ค Sending YouTube auth to backend with refresh token:', !!refreshToken);
|
|
1116
|
+
const backendResponse = await fetch(`${_api.API_CONFIG.BASE_URL}/youtube/native-auth`, {
|
|
1117
|
+
method: 'POST',
|
|
1118
|
+
headers: {
|
|
1119
|
+
'Content-Type': 'application/json',
|
|
1120
|
+
...(authToken && {
|
|
1121
|
+
'Authorization': authToken
|
|
1122
|
+
}) // Include auth token if available
|
|
1123
|
+
},
|
|
1124
|
+
body: JSON.stringify(backendPayload)
|
|
1125
|
+
});
|
|
1126
|
+
console.log('๐ก Backend response status:', backendResponse.status);
|
|
1127
|
+
console.log('๐ก Backend response headers:', backendResponse.headers);
|
|
1128
|
+
if (backendResponse.ok) {
|
|
1129
|
+
var _responseData$validat2, _responseData$tempora2;
|
|
1130
|
+
const responseData = await backendResponse.json();
|
|
1131
|
+
console.log('โ
YouTube connection successful');
|
|
1132
|
+
console.log('๐ COMPLETE BACKEND RESPONSE:');
|
|
1133
|
+
console.log(JSON.stringify(responseData, null, 2));
|
|
1134
|
+
|
|
1135
|
+
// โ
Enhanced verification with temporary mode detection (exact backend fields)
|
|
1136
|
+
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');
|
|
1137
|
+
if (isTemporaryMode) {
|
|
1138
|
+
console.log('๐ [YOUTUBE AUTH] YouTube connected in temporary mode');
|
|
1139
|
+
console.log('โ
[YOUTUBE AUTH] Training will work, but connection expires in ~1 hour');
|
|
1140
|
+
console.log('โน๏ธ [YOUTUBE AUTH] User can reconnect later for refresh tokens if needed');
|
|
1141
|
+
} else if (responseData.hasRefreshToken || responseData.refreshTokenReceived) {
|
|
1142
|
+
console.log('โ
[YOUTUBE AUTH] Backend confirmed refresh token received');
|
|
1143
|
+
console.log('โ
[YOUTUBE AUTH] Full YouTube connection with persistent access');
|
|
1144
|
+
} else {
|
|
1145
|
+
console.warn('โ ๏ธ [YOUTUBE AUTH] Backend did not confirm refresh token');
|
|
1146
|
+
console.warn('๐ [YOUTUBE AUTH] Response data keys:', Object.keys(responseData));
|
|
1147
|
+
console.warn('โ ๏ธ [YOUTUBE AUTH] Connection may fail when tokens expire');
|
|
1148
|
+
}
|
|
1149
|
+
return true;
|
|
1150
|
+
} else {
|
|
1151
|
+
const errorData = await backendResponse.text();
|
|
1152
|
+
console.error('โ YouTube auth failed:', backendResponse.status);
|
|
1153
|
+
console.error('๐ BACKEND ERROR RESPONSE:');
|
|
1154
|
+
console.error(errorData);
|
|
1155
|
+
return false;
|
|
1156
|
+
}
|
|
1157
|
+
} catch (error) {
|
|
1158
|
+
console.error('โ Google Sign-In error:', error);
|
|
1159
|
+
if (error.code === _googleSignin.statusCodes.SIGN_IN_CANCELLED) {
|
|
1160
|
+
console.log('User cancelled Google Sign-In');
|
|
1161
|
+
} else if (error.code === _googleSignin.statusCodes.IN_PROGRESS) {
|
|
1162
|
+
console.log('Google Sign-In already in progress');
|
|
1163
|
+
} else if (error.code === _googleSignin.statusCodes.PLAY_SERVICES_NOT_AVAILABLE) {
|
|
1164
|
+
console.log('Google Play Services not available');
|
|
1165
|
+
}
|
|
1166
|
+
return false;
|
|
1167
|
+
}
|
|
1168
|
+
}
|
|
1169
|
+
|
|
1170
|
+
// Instagram is commented out in the UI, but keeping the code for future use
|
|
1171
|
+
if (platform === 'instagram') {
|
|
1172
|
+
// Simulate Facebook Login SDK for Instagram
|
|
1173
|
+
console.log('Initiating Facebook Login for Instagram');
|
|
1174
|
+
return new Promise(resolve => {
|
|
1175
|
+
setTimeout(() => {
|
|
1176
|
+
console.log('Facebook Login completed successfully');
|
|
1177
|
+
resolve(true);
|
|
1178
|
+
}, 1000);
|
|
1179
|
+
});
|
|
1180
|
+
}
|
|
1181
|
+
return false;
|
|
1182
|
+
};
|
|
1183
|
+
|
|
1184
|
+
/**
|
|
1185
|
+
* Check if a URL is an OAuth callback
|
|
1186
|
+
*/
|
|
1187
|
+
exports.initiateNativeAuth = initiateNativeAuth;
|
|
1188
|
+
const isOAuthCallback = url => {
|
|
1189
|
+
return url.includes('auth/callback') || url.includes('code=');
|
|
1190
|
+
};
|
|
1191
|
+
|
|
1192
|
+
/**
|
|
1193
|
+
* Exchange authorization code for access token
|
|
1194
|
+
* This would typically be done on a server, but we're simulating it here
|
|
1195
|
+
*/
|
|
1196
|
+
exports.isOAuthCallback = isOAuthCallback;
|
|
1197
|
+
const exchangeCodeForToken = async (code, platform) => {
|
|
1198
|
+
console.log(`Exchanging code for token for platform: ${platform}`);
|
|
1199
|
+
try {
|
|
1200
|
+
// Use the proxy server to exchange the code for a token
|
|
1201
|
+
const tokenUrl = `${_api.API_CONFIG.BASE_URL}/${platform}/token`;
|
|
1202
|
+
|
|
1203
|
+
// Make a POST request to the proxy
|
|
1204
|
+
const response = await fetch(tokenUrl, {
|
|
1205
|
+
method: 'POST',
|
|
1206
|
+
headers: {
|
|
1207
|
+
'Content-Type': 'application/json'
|
|
1208
|
+
},
|
|
1209
|
+
body: JSON.stringify({
|
|
1210
|
+
code: code,
|
|
1211
|
+
platform: platform
|
|
1212
|
+
})
|
|
1213
|
+
});
|
|
1214
|
+
if (!response.ok) {
|
|
1215
|
+
console.error(`Error exchanging code for token: ${response.status}`);
|
|
1216
|
+
throw new Error(`Token exchange failed with status ${response.status}`);
|
|
1217
|
+
}
|
|
1218
|
+
const data = await response.json();
|
|
1219
|
+
console.log(`Token exchange successful for ${platform}`);
|
|
1220
|
+
return data;
|
|
1221
|
+
} catch (error) {
|
|
1222
|
+
console.error(`Error exchanging code for token:`, error);
|
|
1223
|
+
|
|
1224
|
+
// Fallback to simulation if the API call fails
|
|
1225
|
+
console.log('Falling back to simulated token response');
|
|
1226
|
+
return {
|
|
1227
|
+
access_token: `${platform}_access_token_${Math.random().toString(36).substring(7)}`,
|
|
1228
|
+
refresh_token: `${platform}_refresh_token_${Math.random().toString(36).substring(7)}`,
|
|
1229
|
+
expires_in: 3600
|
|
1230
|
+
};
|
|
1231
|
+
}
|
|
1232
|
+
};
|
|
1233
|
+
|
|
1234
|
+
/**
|
|
1235
|
+
* Refresh YouTube tokens when they expire
|
|
1236
|
+
* This should be called when the backend reports token expiry
|
|
1237
|
+
*/
|
|
1238
|
+
exports.exchangeCodeForToken = exchangeCodeForToken;
|
|
1239
|
+
const refreshYouTubeTokens = async () => {
|
|
1240
|
+
try {
|
|
1241
|
+
var _currentUser$user3;
|
|
1242
|
+
console.log('๐ Refreshing YouTube tokens...');
|
|
1243
|
+
|
|
1244
|
+
// Get fresh tokens from Google SDK
|
|
1245
|
+
const freshTokens = await _googleSignin.GoogleSignin.getTokens();
|
|
1246
|
+
if (!freshTokens) {
|
|
1247
|
+
console.error('โ Failed to get fresh tokens from Google SDK');
|
|
1248
|
+
return false;
|
|
1249
|
+
}
|
|
1250
|
+
|
|
1251
|
+
// Get current user info
|
|
1252
|
+
const currentUser = await _googleSignin.GoogleSignin.getCurrentUser();
|
|
1253
|
+
if (!currentUser) {
|
|
1254
|
+
console.error('โ No current Google user found');
|
|
1255
|
+
return false;
|
|
1256
|
+
}
|
|
1257
|
+
|
|
1258
|
+
// Get stored auth token using simplified JWT storage
|
|
1259
|
+
const authToken = await (0, _jwtStorageService.getJWT)();
|
|
1260
|
+
if (!authToken) {
|
|
1261
|
+
console.error('โ No auth token found for YouTube refresh');
|
|
1262
|
+
return false;
|
|
1263
|
+
}
|
|
1264
|
+
|
|
1265
|
+
// Send refreshed tokens to backend
|
|
1266
|
+
const refreshResponse = await fetch(`${_api.API_CONFIG.BASE_URL}/youtube/refresh-token`, {
|
|
1267
|
+
method: 'POST',
|
|
1268
|
+
headers: {
|
|
1269
|
+
'Content-Type': 'application/json',
|
|
1270
|
+
'Authorization': authToken
|
|
1271
|
+
},
|
|
1272
|
+
body: JSON.stringify({
|
|
1273
|
+
accessToken: freshTokens.accessToken,
|
|
1274
|
+
idToken: freshTokens.idToken,
|
|
1275
|
+
refreshToken: currentUser.serverAuthCode,
|
|
1276
|
+
userEmail: (_currentUser$user3 = currentUser.user) === null || _currentUser$user3 === void 0 ? void 0 : _currentUser$user3.email,
|
|
1277
|
+
tokenExpiry: new Date(Date.now() + 3600 * 1000).toISOString(),
|
|
1278
|
+
// 1 hour from now
|
|
1279
|
+
timestamp: new Date().toISOString()
|
|
1280
|
+
})
|
|
1281
|
+
});
|
|
1282
|
+
if (refreshResponse.ok) {
|
|
1283
|
+
const responseData = await refreshResponse.json();
|
|
1284
|
+
console.log('โ
YouTube tokens refreshed successfully:', responseData);
|
|
1285
|
+
return true;
|
|
1286
|
+
} else {
|
|
1287
|
+
const errorData = await refreshResponse.text();
|
|
1288
|
+
console.error('โ YouTube token refresh failed:', refreshResponse.status, errorData);
|
|
1289
|
+
return false;
|
|
1290
|
+
}
|
|
1291
|
+
} catch (error) {
|
|
1292
|
+
console.error('โ Error refreshing YouTube tokens:', error);
|
|
1293
|
+
return false;
|
|
1294
|
+
}
|
|
1295
|
+
};
|
|
1296
|
+
|
|
1297
|
+
/**
|
|
1298
|
+
* Trigger training restart after YouTube re-authentication
|
|
1299
|
+
* This signals the backend to restart training with the new refresh token
|
|
1300
|
+
*/
|
|
1301
|
+
exports.refreshYouTubeTokens = refreshYouTubeTokens;
|
|
1302
|
+
const triggerTrainingRestart = async (username, authToken) => {
|
|
1303
|
+
try {
|
|
1304
|
+
console.log('๐ [TRAINING RESTART] Triggering training restart for user:', username);
|
|
1305
|
+
const response = await fetch(`${_api.API_CONFIG.BASE_URL}/mobile-training/restart`, {
|
|
1306
|
+
method: 'POST',
|
|
1307
|
+
headers: {
|
|
1308
|
+
'Content-Type': 'application/json',
|
|
1309
|
+
'Authorization': authToken
|
|
1310
|
+
},
|
|
1311
|
+
body: JSON.stringify({
|
|
1312
|
+
username: username,
|
|
1313
|
+
reason: 'youtube_reauth',
|
|
1314
|
+
platform: 'youtube',
|
|
1315
|
+
timestamp: new Date().toISOString(),
|
|
1316
|
+
requestNewTraining: true
|
|
1317
|
+
})
|
|
1318
|
+
});
|
|
1319
|
+
if (response.ok) {
|
|
1320
|
+
const responseData = await response.json();
|
|
1321
|
+
console.log('โ
[TRAINING RESTART] Training restart successful:', responseData);
|
|
1322
|
+
} else {
|
|
1323
|
+
const errorData = await response.text();
|
|
1324
|
+
console.error('โ [TRAINING RESTART] Training restart failed:', response.status, errorData);
|
|
1325
|
+
throw new Error(`Training restart failed: ${response.status}`);
|
|
1326
|
+
}
|
|
1327
|
+
} catch (error) {
|
|
1328
|
+
console.error('โ [TRAINING RESTART] Error triggering training restart:', error);
|
|
1329
|
+
throw error;
|
|
1330
|
+
}
|
|
1331
|
+
};
|
|
1332
|
+
|
|
1333
|
+
/**
|
|
1334
|
+
* Test function to verify YouTube refresh token functionality
|
|
1335
|
+
* Call this in your app to test the YouTube connection
|
|
1336
|
+
*/
|
|
1337
|
+
const testYouTubeRefreshToken = async username => {
|
|
1338
|
+
console.log('๐งช Testing YouTube refresh token functionality...');
|
|
1339
|
+
console.log('๐ค User:', username);
|
|
1340
|
+
try {
|
|
1341
|
+
// Test the debug function first
|
|
1342
|
+
const debugInfo = await debugYouTubeTokens();
|
|
1343
|
+
console.log('๐ Current token status:', debugInfo);
|
|
1344
|
+
if (!debugInfo.hasRefreshToken) {
|
|
1345
|
+
console.log('โ ๏ธ No refresh token found - attempting to fix...');
|
|
1346
|
+
const success = await fixUserYouTubeConnection(username);
|
|
1347
|
+
if (success) {
|
|
1348
|
+
console.log('โ
YouTube connection fixed! Testing again...');
|
|
1349
|
+
const newDebugInfo = await debugYouTubeTokens();
|
|
1350
|
+
console.log('๐ New token status:', newDebugInfo);
|
|
1351
|
+
} else {
|
|
1352
|
+
console.error('โ Failed to fix YouTube connection');
|
|
1353
|
+
}
|
|
1354
|
+
} else {
|
|
1355
|
+
console.log('โ
Refresh token already available');
|
|
1356
|
+
}
|
|
1357
|
+
} catch (error) {
|
|
1358
|
+
console.error('โ Error testing YouTube refresh token:', error);
|
|
1359
|
+
}
|
|
1360
|
+
};
|
|
1361
|
+
|
|
1362
|
+
/**
|
|
1363
|
+
* Request email verification code
|
|
1364
|
+
*/
|
|
1365
|
+
exports.testYouTubeRefreshToken = testYouTubeRefreshToken;
|
|
1366
|
+
const requestEmailVerification = async (email, testMode = false) => {
|
|
1367
|
+
try {
|
|
1368
|
+
console.log('๐ง Requesting email verification for:', email);
|
|
1369
|
+
|
|
1370
|
+
// ๐ SECURITY: Use developer API key - backend must validate
|
|
1371
|
+
const response = await fetch(`${_api.API_CONFIG.BASE_URL}/email/verification`, {
|
|
1372
|
+
method: 'POST',
|
|
1373
|
+
headers: getDeveloperAuthHeaders(),
|
|
1374
|
+
body: JSON.stringify({
|
|
1375
|
+
email,
|
|
1376
|
+
action: 'request',
|
|
1377
|
+
testMode
|
|
1378
|
+
})
|
|
1379
|
+
});
|
|
1380
|
+
const result = await response.json();
|
|
1381
|
+
if (response.ok) {
|
|
1382
|
+
return {
|
|
1383
|
+
success: true,
|
|
1384
|
+
message: result.message || 'Verification code sent to your email'
|
|
1385
|
+
};
|
|
1386
|
+
} else {
|
|
1387
|
+
return {
|
|
1388
|
+
success: false,
|
|
1389
|
+
error: result.message || 'Failed to send verification code'
|
|
1390
|
+
};
|
|
1391
|
+
}
|
|
1392
|
+
} catch (error) {
|
|
1393
|
+
console.error('โ Error requesting email verification:', error);
|
|
1394
|
+
return {
|
|
1395
|
+
success: false,
|
|
1396
|
+
error: 'Network error. Please check your connection and try again.'
|
|
1397
|
+
};
|
|
1398
|
+
}
|
|
1399
|
+
};
|
|
1400
|
+
|
|
1401
|
+
/**
|
|
1402
|
+
* Verify email code
|
|
1403
|
+
*/
|
|
1404
|
+
exports.requestEmailVerification = requestEmailVerification;
|
|
1405
|
+
const verifyEmailCode = async (email, code, testMode = false) => {
|
|
1406
|
+
try {
|
|
1407
|
+
console.log('๐ Verifying email code for:', email);
|
|
1408
|
+
|
|
1409
|
+
// ๐ SECURITY: Use developer API key - backend must validate before issuing JWT
|
|
1410
|
+
const response = await fetch(`${_api.API_CONFIG.BASE_URL}/email/verification`, {
|
|
1411
|
+
method: 'POST',
|
|
1412
|
+
headers: getDeveloperAuthHeaders(),
|
|
1413
|
+
body: JSON.stringify({
|
|
1414
|
+
email,
|
|
1415
|
+
code,
|
|
1416
|
+
action: 'verify',
|
|
1417
|
+
testMode
|
|
1418
|
+
})
|
|
1419
|
+
});
|
|
1420
|
+
const result = await response.json();
|
|
1421
|
+
if (response.ok) {
|
|
1422
|
+
return {
|
|
1423
|
+
success: true,
|
|
1424
|
+
message: result.message || 'Email verified successfully',
|
|
1425
|
+
existingUser: result.existingUser || false,
|
|
1426
|
+
token: result.token
|
|
1427
|
+
};
|
|
1428
|
+
} else {
|
|
1429
|
+
return {
|
|
1430
|
+
success: false,
|
|
1431
|
+
error: result.message || 'Invalid verification code'
|
|
1432
|
+
};
|
|
1433
|
+
}
|
|
1434
|
+
} catch (error) {
|
|
1435
|
+
console.error('โ Error verifying email code:', error);
|
|
1436
|
+
return {
|
|
1437
|
+
success: false,
|
|
1438
|
+
error: 'Network error. Please check your connection and try again.'
|
|
1439
|
+
};
|
|
1440
|
+
}
|
|
1441
|
+
};
|
|
1442
|
+
|
|
1443
|
+
/**
|
|
1444
|
+
* Check email verification status
|
|
1445
|
+
*/
|
|
1446
|
+
exports.verifyEmailCode = verifyEmailCode;
|
|
1447
|
+
const checkEmailVerificationStatus = async (email, testMode = false) => {
|
|
1448
|
+
try {
|
|
1449
|
+
// ๐ SECURITY: Use developer API key - backend must validate
|
|
1450
|
+
const response = await fetch(`${_api.API_CONFIG.BASE_URL}/email/verification/status`, {
|
|
1451
|
+
method: 'POST',
|
|
1452
|
+
headers: getDeveloperAuthHeaders(),
|
|
1453
|
+
body: JSON.stringify({
|
|
1454
|
+
email,
|
|
1455
|
+
testMode
|
|
1456
|
+
})
|
|
1457
|
+
});
|
|
1458
|
+
const result = await response.json();
|
|
1459
|
+
return {
|
|
1460
|
+
success: response.ok,
|
|
1461
|
+
isPending: result.isPending || false,
|
|
1462
|
+
message: result.message
|
|
1463
|
+
};
|
|
1464
|
+
} catch (error) {
|
|
1465
|
+
console.error('โ Error checking email verification status:', error);
|
|
1466
|
+
return {
|
|
1467
|
+
success: false,
|
|
1468
|
+
isPending: false,
|
|
1469
|
+
error: 'Network error'
|
|
1470
|
+
};
|
|
1471
|
+
}
|
|
1472
|
+
};
|
|
1473
|
+
|
|
1474
|
+
/**
|
|
1475
|
+
* Initialize platform auth service
|
|
1476
|
+
*/
|
|
1477
|
+
exports.checkEmailVerificationStatus = checkEmailVerificationStatus;
|
|
1478
|
+
const initializePlatformAuthService = () => {
|
|
1479
|
+
console.log('๐ง Platform auth service initialized');
|
|
1480
|
+
// Initialize Google Sign-In
|
|
1481
|
+
initializeGoogleSignIn();
|
|
1482
|
+
};
|
|
1483
|
+
exports.initializePlatformAuthService = initializePlatformAuthService;
|
|
1484
|
+
//# sourceMappingURL=platformAuthService.js.map
|