How do I find out what is set and how to retrieve it?


#1

I’m working with a library called ember-simple-auth and I’ve got my login successful, but I have no idea how to figure out where things are being set such as my login email. Is there a way to explore the data set in my current state?


#2

Have a look at the Ember Inspector which is a very useful tool for doing the things you describe.

You’ll also probably want to have a look at the Debugging page.


#3

ember-simple-auth will automatically store the returned payload on its ‘session’ object which is available in your controller/views/etc… but I would start by looking in Resources > Local Storage in chrome dev tools

Also: console.log @get('session') || console.log(this.get('session')); from your route or controller.

Usually the returned payload will have the Oauth access_token which gets used in the HTTP headers for all requests, the session will also have attributes like the users email if it was returned in the initial payload. In my case it is not and we had to add a CustomSession object and make a request to our /me endpoint to get this data. See http://blog.willrax.com/fetching-the-current-user-with-simple-auth/ for an example.