When including the user object during a login, attempting to access the user object in an afterRemote hook is not intuitive. The full object graph is evaluated when doing a console.log and in the response, but I cannot seem to find a way to access the included model with normal object syntax.
console.log(accessToken); // outputs the entire object graph
console.log(accessToken.user);
/* outputs
{ [Function]
getAsync: [Function],
update: [Function],
destroy: [Function],
create: [Function],
build: [Function],
_targetClass: 'user' }
*/
I assume the user is not evaluated by the time I'm attempting to access it. Am I missing something simple? It would be intuitive to me that the entire graph is available in the afterRemote hook.
Call accessToken.toJSON().user
Thank you @raymondfeng. This would be great to add to the docs under Querying data and the remote hooks sections.
See http://docs.strongloop.com/display/LB/Include+filter#Includefilter-Accessincludedobjects
Hi:
Do you know if upsert method is available ???
Best Regards
Most helpful comment
Call accessToken.toJSON().user