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:
- 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)
- 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)
- 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.
- 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