You can not. has_secure_password automatically adds two validators to your model:
validates_confirmation_of :password validates_presence_of :password_digest
Instead, set a dummy value for password_digest for users who do not have a password:
user.password = user.password_confirmation = "" user.password_digest = "facebook-authorized account"
This is safe because the password cannot be hashed to match this digest.
source share