How to access session properties in Handlebar templates


#1

Hi there,

I managed to get ember-simple-auth running with a token. Looks like my session gets persisted in the browser’s local storage and all of my network requests are outfitted with the right token. Nice!

Localstorage looks like this:

ember_simple_auth:session: {"authenticated":{"authenticator":"authenticator:custom","username":"super","token":"520[SOMESTUFDELETED]bf7f3b","success":true,"error":null}}

Simple question: How do I access e. g. the value “username” from session within the handlebars template. While {{session.isAuthenticated}} works fine I want to echo something like {{session.username}}.

Thanks in advance!

Martin


#2

Did you try {{session.data.authenticated.username}}?


#3

Works! Thank you. Do you mind telling me where this is documented?

Thanks,

Martin


#4

Sure. Some information can be learned here. And docs ofc.