i am interested in logic of authentication by phone, i know a lot of services that offer user to authenticate with either phone or email during login, say Facebook. but what i am concerned about is that when you authenticate with phone on facebook it does not require you to put in country code and according to this wikipedia link lot of countries have same size of phone number, wouldn't it create problems for facebook if they could not determine country code of phone number, i know chances of this are slim but if two people from this type of countries which have same size of phone number digits, had the same password it would be a problem i reckon, so i know there is pretty good library called libphonenumber-js
, can this library determine with 100% accuracy country code from given phone number without prefix (of country code)?
libphonenumber-js is a lib for validating and analyzing an international phone number and it doesn't auto detect country code
There are other ways to auto detect country f.e
val tm = applicationContext
.getSystemService(Context.TELEPHONY_SERVICE) as TelephonyManager
val country = tm.simCountryIso