This demo shows how to do a full session management in Backbone.js.
We attach a top level singleton currentUser object. Views can then listen to any signIn
or signOut
events on this object.
this.currentUser = new BackboneAuthDemo.Models.CurrentUser();
In the router we can use _requireSignedIn
and _requireSignedOut
functions to enforce the desired session state.
Files to check out:
View the omniauth branch to see Twitter sign in integration.