creating an authentication mechanism with AngularJ

2019-07-11 20:47发布

I try to create with angularjs based Ionic app an authentication mechanism. The system looks like this:

enter image description here

mobile users are created by administrators on the server. This created mobile user can login into the app.

The users are stored on the server in a JSON object. I had imagined the steps as following?

  1. The link to the JSON object should be parsed.
  2. The created users and passwords on the server are to be compared with the locally login data
  3. If the user has successfully logged into the system, the user data should be stored locally.

Edit:

The flow of the authentication will be effected as follows:

enter image description here

How to create a login system like this programmatically?

1条回答
别忘想泡老子
2楼-- · 2019-07-11 21:29

The steps should be

1) Send username password to server using $http.post();

2) Server authenticates the credentials. and returns a token in return is credentials are correct.

3) App stores this token locally and passes it to server for later request as a mean of identification of logged in user.

Ideally you should implement SOAP or REST based services on your server and consume those services in your app.

查看更多
登录 后发表回答