File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Expand file tree Collapse file tree 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', () => {
12091209 done ( ) ;
12101210 } ) ;
12111211
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+
12121227 it ( 'can not set authdata to null' , async ( ) => {
12131228 try {
12141229 const provider = getMockFacebookProvider ( ) ;
Original file line number Diff line number Diff line change @@ -429,7 +429,8 @@ RestWrite.prototype.handleAuthDataValidation = function (authData) {
429429 return Promise . resolve ( ) ;
430430 }
431431 const validateAuthData = this . config . authDataManager . getValidatorForProvider ( provider ) ;
432- if ( ! validateAuthData ) {
432+ const authProvider = ( this . config . auth || { } ) [ provider ] || { } ;
433+ if ( ! validateAuthData || authProvider . enabled === false ) {
433434 throw new Parse . Error (
434435 Parse . Error . UNSUPPORTED_SERVICE ,
435436 'This authentication method is unsupported.'
You can’t perform that action at this time.
0 commit comments