So I have a ember-rails app set up with an authentication API and I can successfully (or not) authenticate with ember auth and everything works. However, the authentication only persists for the duration of the current application session. If I reload the page or enter the URL, I must re-authenticate.
Is there some setting or configuration necessary to make the auth token longer lived? I'm not necessarily talking about "Remember Me" functionality, so much as making a single session a bit hardier.
My basic code:
Auth Object:
App.Auth = Em.Auth.create
currentUser: null
signInEndPoint: '/users/sign_in'
signOutEndPoint: '/users/sign_out'
tokenKey: 'auth_token'
tokenIdKey: 'user_id'
Sign in View:
App.AuthSignInView = Ember.View.extend
templateName: 'auth/sign_in'
email: null
password: null
submit: (event, view) ->
event.preventDefault()
event.stopPropagation()
StripfighterEmber.Auth.signIn
data:
email: @get 'email'
password: @get 'password'
Auth Template:
<form class="form-inline">
{{view Ember.TextField class="input-small" placeholder="Email" valueBinding="view.email"}}
{{view Ember.TextField type="password" class="input-small" placeholder="Password" valueBinding="view.password"}}
<button type="submit" class="btn btn-inverse btn-small">Sign in</button>
</form>