How to access "current logged-in user" in remote methods?
<p>recently in one of my applications I needed to access currently logged-in user data for saving in another model (something like the author of a book or owner of a book). in my googling, I encountered these references but none of them was useful.</p>

<p><a href="https://github.com/strongloop/loopback/issues/1495" rel="nofollow">https://github.com/strongloop/loopback/issues/1495</a></p>

<p><a href="https://docs.strongloop.com/display/public/LB/Using+current+context" rel="nofollow">https://docs.strongloop.com/display/public/LB/Using+current+context</a></p>

<p>...</p>

<p>all of them have this problem about accessing <code>context</code> or <code>req</code> object. after three days I decided to switch to <code>afterRemote</code> remote hook and add Owner or Author on that stage.
but something was wrong with this solution.</p>

<p>in strongloop's documentations (<a href="https://docs.strongloop.com/display/public/LB/Remote+hooks" rel="nofollow">https://docs.strongloop.com/display/public/LB/Remote+hooks</a>) there is a variable as <code>ctx.req.accessToken</code> that saves current logged-in user access token. but in the application this variable is undefined.
instead, I found accessToken in <code>ctx.req.query.access_token</code> and it was currently access_token variable that is sent to the server. </p>

<p>here is my <strong>problem</strong>:</p>

<ol>
<li><p>is this variable (<code>ctx.req.query.access_token</code>) always available or
it's just because loopback-explorer send access_token as <code>GET</code>
variable?</p></li>
<li><p>in production mode do applications need to send <code>access_token</code> as
GET variable or it should be sent as <code>Authorization</code> in the header?</p></li>
<li><p>why <code>ctx.req.accessToken</code> is undefined?</p></li>
<li><p>could these things change over time? cause most of users encounter this problem due to deprecation of <code>app.getCurrentContext()</code></p></li>
</ol>