K
K
kkoshakk2016-02-01 20:30:33
MySQL
kkoshakk, 2016-02-01 20:30:33

How to register and authorize users through a mobile number?

How to register and authorize users through a mobile number?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
motcart, 2016-02-01
@kkoshakk

To do this, you need to send SMS through some service using their API. Either send SMS to each user from a regular phone (or automate this by connecting the phone to a computer). The first option, I think, will cost less. Basically everyone does it.

T
Tirael78, 2016-02-02
@Tirael78

you need:
1 connect to the SMS distribution service, the best solution is through an existing gateway, for example in Russia, after a lot of search we settled on smsc.ru (this is not advertising), they have a good api, prices are in the market.
2 It is necessary to implement interaction with api sms gateway on your server (depending on the choice of api).
3 On the server side, it is necessary to generate a confirmation code, for example, a set of 4 or 6 numbers or letters, or another combination. Save a bunch of user - confirmation code to be able to compare in the future.
4 using the gateway api send a confirmation code to the user number.
5 the subscriber enters the confirmation code and sends it to the server using any mechanism you implement.
6 Having received confirmation, check that this particular code was sent to this user. If the data matched, authorize the user.
Some implementation tips:
1 set the code lifetime, this is necessary for security
2 enter a limit on the number of input attempts, again for security
3 when interacting with the gateway api, you need to analyze the responses to your requests, say a person entered a non-existent phone number, made a mistake , you need to correctly handle this situation, there can be quite a lot of such moments.
4 some gateways (such as the one I indicated above) will accept a Russian number in the format 89 and so on, but you need to understand that it is not a fact that all gateways will do this, the correct Russian code is 7, and therefore the mobile number should start with 79, in other countries there are their characteristics, and this must be taken into account.
5 set the lifetime of the SMS message (if the gateway allows it in its api) to be no more than the lifetime of the code on your server, for example, a person is out of network coverage, and the SMS will come to him in 1 hour, when it will no longer be relevant, as a result you pay for a meaningless SMS message, if you have a lot of subscribers, as a result, a large amount may run up. Otherwise, the message will simply not be sent and you will save money.
In fact, there are many more nuances, depending on the needs of your service, but in general terms something like this.

D
Dmitry Kuznetsov, 2016-02-01
@dima9595

Please clarify what exactly is needed? Instead of login and password - phone number and password?
Or sending SMS to a number for authorization?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question