File tree 2 files changed +17
-1
lines changed
2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -1209,6 +1209,21 @@ describe('Parse.User testing', () => {
1209
1209
done ( ) ;
1210
1210
} ) ;
1211
1211
1212
+ it ( 'can disable provider' , async ( ) => {
1213
+ await reconfigureServer ( {
1214
+ auth : {
1215
+ facebook : {
1216
+ enabled : false ,
1217
+ } ,
1218
+ } ,
1219
+ } ) ;
1220
+ const provider = getMockFacebookProvider ( ) ;
1221
+ Parse . User . _registerAuthenticationProvider ( provider ) ;
1222
+ await expectAsync ( Parse . User . _logInWith ( 'facebook' ) ) . toBeRejectedWith (
1223
+ new Parse . Error ( Parse . Error . UNSUPPORTED_SERVICE , 'This authentication method is unsupported.' )
1224
+ ) ;
1225
+ } ) ;
1226
+
1212
1227
it ( 'can not set authdata to null' , async ( ) => {
1213
1228
try {
1214
1229
const provider = getMockFacebookProvider ( ) ;
Original file line number Diff line number Diff line change @@ -429,7 +429,8 @@ RestWrite.prototype.handleAuthDataValidation = function (authData) {
429
429
return Promise . resolve ( ) ;
430
430
}
431
431
const validateAuthData = this . config . authDataManager . getValidatorForProvider ( provider ) ;
432
- if ( ! validateAuthData ) {
432
+ const authProvider = ( this . config . auth || { } ) [ provider ] || { } ;
433
+ if ( ! validateAuthData || authProvider . enabled === false ) {
433
434
throw new Parse . Error (
434
435
Parse . Error . UNSUPPORTED_SERVICE ,
435
436
'This authentication method is unsupported.'
You can’t perform that action at this time.
0 commit comments