Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase Password Validation allowed regex

I was wondering if anyone knew the official allowed passwords for Firebase's Email and Password Authentication API.

So far I understand that there is

  • a minimum of 6 characters required
  • a-z allowed
  • A-Z allowed
  • 0-9 allowed
  • special characters allowed ~`!@#$%^&*()-_+=|}]{["':;?/>.<,
  • white spaces allowed

If this is the case, would the regex for validation on my side just be {6,} ? (alternatively I could just check the length of the field)

EDIT: I assume it's similar to Google's normal password requirements but only requiring 6 characters instead of 8.

like image 302
Hellojeffy Avatar asked Jun 27 '16 22:06

Hellojeffy


2 Answers

For anyone looking for a regular expression to validate password before sending to firebase.

I suggest to use this pattern as it pass as minimum qualifications! also firebase verify and validate password after you send it too Firebase cloud... so keep it simple.

let pattern: String = "(?=.*[0-9a-zA-Z]).{6,}"
  1. Minimum 6 character: {6,}
  2. Any character allowed: (?=.*[0-9a-zA-Z])

Remember, it is just the minimum requirements for a valid password, you can choose how strong the password should be based on your software.

like image 91
Mohammad Reza Koohkan Avatar answered Nov 14 '22 14:11

Mohammad Reza Koohkan


Your understanding is correct - the only requirement is a minimum of 6 chars.

However, if you are building Android/iOS apps, I would suggest -not- to hardcode the validation logic in your app, since the new user signup request is handled by Firebase Auth server.

like image 26
Jin Liu Avatar answered Nov 14 '22 14:11

Jin Liu