ember-cli-simple-auth-devise icon indicating copy to clipboard operation
ember-cli-simple-auth-devise copied to clipboard

Session data persisted under "secure" with resourceName as "user"

Open benbabics opened this issue 9 years ago • 0 comments

Hello,

I'm trying to access the current user data from my session, and would like to persist additional data in the session for completing a registration workflow that I check against in routes outside of the workflow and redirect as needed. Researching this I stumbled on the following which seems to provide some insights: http://stackoverflow.com/questions/30872684/ember-simple-auth-injecting-current-user-into-every-route

However it seems that the user key is not in local storage, rather it's under secure. So if I wanted to do something like get the session email, I'd have to do something like this: {{ session.secure.email }} or {{ session.secure.activated }}

Looking at the local storage I see: {"secure":{"authenticator":"simple-auth-authenticator:devise","email":"[email protected]","token":"Qw95117abc87fxxB66zo","activated":false}}

In my environment.js file I've added resourceName as user:

ENV['simple-auth'] = {
    authorizer: 'simple-auth-authorizer:devise',
    crossOriginWhitelist: [ENV.API_URL]
  };
  ENV['simple-auth-devise'] = {
    resourceName: 'user',
    identificationAttributeName: 'email',
    tokenAttributeName: 'token',
    serverTokenEndpoint: `${ENV.API_URL}/users/sign_in`
  };

benbabics avatar Oct 08 '15 13:10 benbabics