javascript - How to manage authentication with token in angular.js? -
Hi Everyone I created a RESTIPAL API with authentication along with Token (Rail 4 + Device), as well as manage the CORS implementation. Mani (rack-cores) but now I want to use encoding with encoding.
For this, I do this:
var app = angular Module ('model'); App.factory ('session', ['$ resource', work ($ resource) {var session = $ resource ('http://api.creositios.dev/sessions/:id', {}, {create: { Method: 'Post'}, Delete: {Method: 'Delete', Parameters: {ID: 'id'}}}); Return session;}]);
And this is my controller
app = angular. Module ('controller'); App.controller ('session' Ctrl, ['$ scope', 'session', function ($ scope, session) {$ scope.new_session = function () {$ scope.session = session .create ({email: 'developer Jimenez@gmail.com, password: '12345678'});};}]);
So far I have no problem with implementation. My problem is not known how the management is broken, which returns to my factory.
What are good practices for managing a user's token with angular.js and are valid in angular.js in the user angle controller?
With certification with the token this is my first app advice very much appreciate !.