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: 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":"user@example.com","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` };
Is there a way I can access the current user data (e.g. email and activated) in my routes? Any help is much appreciated.
Aucun commentaire:
Enregistrer un commentaire