@onairos/react-native 3.1.3 → 3.1.5
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/components/UniversalOnboarding.js +0 -4
- package/lib/commonjs/components/UniversalOnboarding.js.map +1 -1
- package/lib/commonjs/components/onboarding/OAuthWebView.js +13 -3
- package/lib/commonjs/components/onboarding/OAuthWebView.js.map +1 -1
- package/lib/commonjs/services/apiKeyService.js +11 -5
- package/lib/commonjs/services/apiKeyService.js.map +1 -1
- package/lib/module/components/UniversalOnboarding.js +0 -4
- package/lib/module/components/UniversalOnboarding.js.map +1 -1
- package/lib/module/components/onboarding/OAuthWebView.js +13 -3
- package/lib/module/components/onboarding/OAuthWebView.js.map +1 -1
- package/lib/module/services/apiKeyService.js +11 -5
- package/lib/module/services/apiKeyService.js.map +1 -1
- package/lib/typescript/components/UniversalOnboarding.d.ts.map +1 -1
- package/lib/typescript/components/onboarding/OAuthWebView.d.ts.map +1 -1
- package/lib/typescript/services/apiKeyService.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/UniversalOnboarding.tsx +1 -5
- package/src/components/onboarding/OAuthWebView.tsx +20 -7
- package/src/services/apiKeyService.ts +12 -5
|
@@ -318,11 +318,7 @@ export const UniversalOnboarding: React.FC<UniversalOnboardingProps> = ({
|
|
|
318
318
|
}));
|
|
319
319
|
|
|
320
320
|
console.log(`✅ Instagram successfully connected for user: ${instagramUsername}`);
|
|
321
|
-
|
|
322
|
-
'Instagram Connected',
|
|
323
|
-
`Successfully connected to Instagram as ${instagramUsername} via Opacity SDK.`,
|
|
324
|
-
[{ text: 'OK', style: 'default' }]
|
|
325
|
-
);
|
|
321
|
+
|
|
326
322
|
} else {
|
|
327
323
|
throw new Error('Invalid or empty Instagram profile data returned from Opacity SDK');
|
|
328
324
|
}
|
|
@@ -392,7 +392,8 @@ export const OAuthWebView: React.FC<OAuthWebViewProps> = ({
|
|
|
392
392
|
}
|
|
393
393
|
}
|
|
394
394
|
|
|
395
|
-
// Check for traditional OAuth callback patterns
|
|
395
|
+
// Check for traditional OAuth callback patterns (more specific)
|
|
396
|
+
// Only match actual query parameters, not just any occurrence in the URL
|
|
396
397
|
const callbackPatterns = [
|
|
397
398
|
'code=',
|
|
398
399
|
'access_token=',
|
|
@@ -400,16 +401,28 @@ export const OAuthWebView: React.FC<OAuthWebViewProps> = ({
|
|
|
400
401
|
'authorization_code=',
|
|
401
402
|
'auth_code=',
|
|
402
403
|
'token=',
|
|
403
|
-
'callback',
|
|
404
|
-
'success',
|
|
405
|
-
'complete',
|
|
406
|
-
'connected',
|
|
407
|
-
'authorized',
|
|
408
404
|
];
|
|
409
405
|
|
|
410
406
|
for (const pattern of callbackPatterns) {
|
|
411
407
|
if (url.includes(pattern)) {
|
|
412
|
-
console.log('✅ OAuth success detected via callback
|
|
408
|
+
console.log('✅ OAuth success detected via callback parameter:', pattern);
|
|
409
|
+
return true;
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
// Check for specific callback URLs (more targeted than generic words)
|
|
414
|
+
const callbackUrlPatterns = [
|
|
415
|
+
'/callback',
|
|
416
|
+
'/oauth/callback',
|
|
417
|
+
'/auth/callback',
|
|
418
|
+
'redirect_uri',
|
|
419
|
+
'onairos.uk/callback',
|
|
420
|
+
'onairos.uk/oauth',
|
|
421
|
+
];
|
|
422
|
+
|
|
423
|
+
for (const pattern of callbackUrlPatterns) {
|
|
424
|
+
if (url.includes(pattern)) {
|
|
425
|
+
console.log('✅ OAuth success detected via callback URL pattern:', pattern);
|
|
413
426
|
return true;
|
|
414
427
|
}
|
|
415
428
|
}
|
|
@@ -61,8 +61,9 @@ export const initializeApiKey = async (config: OnairosConfig): Promise<void> =>
|
|
|
61
61
|
throw new Error('Developer API key is required for SDK initialization');
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
if (
|
|
65
|
-
|
|
64
|
+
// Check if it's admin key first (admin key is shorter than 32 chars)
|
|
65
|
+
if (!isAdminKey(config.apiKey) && config.apiKey.length < 32) {
|
|
66
|
+
throw new Error('Invalid API key format. Developer keys must be at least 32 characters long.');
|
|
66
67
|
}
|
|
67
68
|
|
|
68
69
|
// Set global configuration
|
|
@@ -84,11 +85,11 @@ export const initializeApiKey = async (config: OnairosConfig): Promise<void> =>
|
|
|
84
85
|
});
|
|
85
86
|
}
|
|
86
87
|
|
|
87
|
-
// Validate the
|
|
88
|
+
// Validate the API key (handles both admin and developer keys)
|
|
88
89
|
const validation = await validateApiKey(config.apiKey);
|
|
89
90
|
|
|
90
91
|
if (!validation.isValid) {
|
|
91
|
-
throw new Error(`
|
|
92
|
+
throw new Error(`API key validation failed: ${validation.error}`);
|
|
92
93
|
}
|
|
93
94
|
|
|
94
95
|
// Try to load existing JWT token
|
|
@@ -98,7 +99,13 @@ export const initializeApiKey = async (config: OnairosConfig): Promise<void> =>
|
|
|
98
99
|
|
|
99
100
|
if (globalConfig.enableLogging) {
|
|
100
101
|
console.log('✅ Onairos SDK initialized successfully');
|
|
101
|
-
|
|
102
|
+
|
|
103
|
+
if (isAdminKey(config.apiKey)) {
|
|
104
|
+
console.log('🔑 Admin API key ready with full permissions');
|
|
105
|
+
} else {
|
|
106
|
+
console.log('🔑 Developer API key ready for app-level operations');
|
|
107
|
+
}
|
|
108
|
+
|
|
102
109
|
if (userToken) {
|
|
103
110
|
console.log('🎫 User JWT token loaded from storage');
|
|
104
111
|
}
|