How can we prevent user from signing up with username and password?

we want our users to only login with account kit and don't want someone try to sign up with email address or other login methods.

we don't provide this as our auth but someone can create a custom login code and try to manipulate our parse server to bypass the auth method.

oauth: {
        accountkit: {
            appIds: '',
            appSecret: ''
        },
        **email: false**
     },

is there any option to disable legacy signup method? (email: false)?

up vote 0 down vote accepted

in my app which use Facebook and Twitter Oauth for login/registrer user. I control in before save trigger if the user provide authData.

Parse.Cloud.beforeSave(Parse.User, function(request, response) {
  const user = request.object;
  if (user.get("authData")) {
    response.success(request.object);
  } else {
    response.error("Only oauth allow");
  }
});

I don't know if it's a good method but it lock the signup with username/password.

Edit : The first solution is not good because it will throw error every time the user is updated I found a better solution :

if (request.user || request.master) {
    response.success(request.object);
} else {
  const user = request.object;
  if (user.get("authData")) {
    response.success(request.object);
  } else {
    response.error("Only OAuth login allowed");
  }
}

IIn this case we did the control only if the request is not executed by a logged user or using the masterKey (parse dashboard for exemple)

  • Finally Someone answered. – OceanOne Jun 20 at 19:06

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.