Skip to content

Commit df60d83

Browse files
committed
fix(app-check): better validation of configuration
some confusion came up while supporting users trying to adopt the new style, this should help future intrepid developers
1 parent e0e9e3f commit df60d83

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

packages/app-check/lib/index.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,26 @@ class FirebaseAppCheckModule extends FirebaseModule {
6161
}
6262
this.native.setTokenAutoRefreshEnabled(options.isTokenAutoRefreshEnabled);
6363

64+
if (options.provider === undefined || options.provider.providerOptions === undefined) {
65+
throw new Error('Invalid configuration: no provider or no provider options defined.');
66+
}
6467
if (Platform.OS === 'android') {
68+
if (!isString(options.provider.providerOptions.android.provider)) {
69+
throw new Error(
70+
'Invalid configuration: no android provider configured while on android platform.',
71+
);
72+
}
6573
return this.native.configureProvider(
6674
options.provider.providerOptions.android.provider,
6775
options.provider.providerOptions.android.debugToken,
6876
);
6977
}
7078
if (Platform.OS === 'ios' || Platform.OS === 'macos') {
79+
if (!isString(options.provider.providerOptions.apple.provider)) {
80+
throw new Error(
81+
'Invalid configuration: no apple provider configured while on apple platform.',
82+
);
83+
}
7184
return this.native.configureProvider(
7285
options.provider.providerOptions.apple.provider,
7386
options.provider.providerOptions.apple.debugToken,

0 commit comments

Comments
 (0)