mardi 11 août 2015

Architecture for User-Registration (here: With using Facebook)

Im writing a user registration mechanism by hand so I dont want to use existing plugins or something.

Im wondering what the best way would be. I planning to do the following abstract steps:

  1. Writing an component which is in charge to output a button which calls the facebook-api --> login in via facebook (Im getting token and user name/id)
  2. In my route im using that Data to call the REST-Server-Backend of my app. I will pass the token as well as the username/id to the Server. (POST api.myapp.com/users)
  3. The Server recieves the request and will validate via Facebook-API the user data and token on its own --> if valid: Add new user to database.
  4. If the user wants to login now (after registration) he will do again step no.1 and than will ask the server if the user is existing. But how: Since ember suggest that the REST-Server is somekind of a CRUD-Server and using the store is for working for model data only, there is no possiblity to do a "logic"-call to the server like "ask him if user with id is existing". Should I call "GET ../users/" and than check in my route if the sum of the returned records are smaller than 1?

So is that a common pattern?




Aucun commentaire:

Enregistrer un commentaire