android - Register user without password in XMPP -
i want implement registration functionality same whatsapp (without password). search alot not getting best solution.
currently i'm using device id , password register user, , working fine. if user logged out or want login other device how can proceed them new device id?
my current code device id , register user :
telephonymanager telephonymanager = (telephonymanager) getsystemservice(context.telephony_service); if (activitycompat.checkselfpermission(this, manifest.permission.read_phone_state) != packagemanager.permission_granted) { return; } string androidid = telephonymanager.getdeviceid(); accountmanager accountmanager = accountmanager.getinstance(xmpptcpconnection); try { localpart = localpart.from(mobilenumber); if (accountmanager.supportsaccountcreation()) { accountmanager.sensitiveoperationoverinsecureconnection(true); accountmanager.createaccount(mobilenumber, androidid); } } catch (exception e) { throw new smackinvocationexception(e); }
- what if enter phone number , device id of victim authenticate him , read messages? first of all, need verify have access phone number verification code via sms/call.
- what if want log in account desktop or apple device? should not rely on android device id, , shouldn't password. can create random token string when user add new device (after verification!) , keep tokens on server linked user phone number.
- how app create account in case? should have custom application on server, receives verification codes , generates password strings.
- how app authenticate? xmpp standards uses pluggable authentication framework (sasl) , server , client apps should implement "token-based" sasl mechanism , uses instead of "password-based".
Comments
Post a Comment