M
M
magicrushheroes2016-07-21 14:22:51
JavaScript
magicrushheroes, 2016-07-21 14:22:51

How to create a mock authorization service in angular 1?

I ask for self-education, so the backend is not needed.
In general, I asked myself how to implement this: an authorization page, you need to enter a phone number, the data is transferred to the service and a token is returned (it can be any, no matter), then as I understand it, it should be saved to local memory, then the SMS input page opens, after entering the saved token and the entered SMS are transferred to the service, the token and the SMS are compared, and depending on the result, one or another page is returned. There is no need to send SMS anywhere, it can be hardcoded. Yes, this does not look like a question, but a task, but I'm not asking you to do it for me. Me principles to learn how to do this or that action. In outline. For example, how to generate and return a token and how to compare it later. That is, I do not quite understand how to work with a token.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Oleg, 2016-07-21
@magicrushheroes

The token is generated on the server, so there is no way to do without a backend.
To work with tokens in AngularJS, you can use or look at the sources of Ng-token-auth

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question