<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hi Alex,<br>
<br>
Did you had a look at
<a class="moz-txt-link-freetext" href="https://www.npmjs.com/package/express-hawkauth#how-are-the-shared-credentials-shared">https://www.npmjs.com/package/express-hawkauth#how-are-the-shared-credentials-shared</a>
?<br>
<br>
It is the way to derive the Hawk-Session-Token as hawk credentials.<br>
<br>
Also you can use the hawk module to build your Hawk headers.
<a class="moz-txt-link-freetext" href="https://www.npmjs.com/package/hawk">https://www.npmjs.com/package/hawk</a><br>
<br>
Regards,<br>
<br>
Rémy<br>
<br>
<div class="moz-cite-prefix">Le 15/04/2015 13:08, Oleksandr Kyetov a
écrit :<br>
</div>
<blockquote
cite="mid:CA+GOB=nj-73-uTHwMWmcj9g--26=Q2pQ-gbTv=Haupi8hjd=HA@mail.gmail.com"
type="cite">
<div dir="ltr">
<div>Hi, Firefox Team,</div>
<div><br>
</div>
<div>I hate being annoying, any information on the e-mail below
will be really helpful, as I tried everything what I could
come up with</div>
<div><br>
</div>
Thank you in advance,
<div>Alex K.<br>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Wed, Apr 8, 2015 at 10:15 PM,
Oleksandr Kyetov <span dir="ltr"><<a
moz-do-not-send="true"
href="mailto:oleksandr.kyetov@gmail.com"
target="_blank">oleksandr.kyetov@gmail.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><span
style="font-size:12.8000001907349px">Guys, thatns
you for response,</span>
<div>
<div class="h5">
<div style="font-size:12.8000001907349px"><br>
</div>
<div style="font-size:12.8000001907349px">It
really helped me a lot, and I let myself play a
little with:</div>
<div style="font-size:12.8000001907349px"><a
moz-do-not-send="true"
href="https://github.com/mozilla/fxa-oauth-server"
target="_blank">https://github.com/mozilla/fxa-oauth-server</a></div>
<div style="font-size:12.8000001907349px"><a
moz-do-not-send="true"
href="https://github.com/mozilla/fxa-auth-server"
target="_blank">https://github.com/mozilla/fxa-auth-server</a></div>
<div style="font-size:12.8000001907349px"><br>
</div>
<div style="font-size:12.8000001907349px">But,
unfortunately it is not quite what I need</div>
<div style="font-size:12.8000001907349px"><br>
</div>
<div style="font-size:12.8000001907349px">My
context is next:</div>
<div style="font-size:12.8000001907349px">1) There
is no client UI at all</div>
<div style="font-size:12.8000001907349px">2) I
have Firefox Account credentials stored in the
backend</div>
<div style="font-size:12.8000001907349px">3)
Backend written via NodeJS</div>
<div style="font-size:12.8000001907349px"><br>
</div>
<div style="font-size:12.8000001907349px">The flow
is next:</div>
<div style="font-size:12.8000001907349px">1)
Something call backend server;</div>
<div style="font-size:12.8000001907349px">2)
fxa-auth-server endpoint <a
moz-do-not-send="true"
href="https://github.com/mozilla/fxa-auth-server/blob/master/docs/api.md#post-v1accountlogin"
target="_blank">https://github.com/mozilla/fxa-auth-server/blob/master/docs/api.md#post-v1accountlogin</a> called,
which returns session token</div>
<div style="font-size:12.8000001907349px">3) Hawk
credentials is derived from session token
received in step 2)</div>
<div style="font-size:12.8000001907349px"><br>
</div>
<div style="font-size:12.8000001907349px">What I
can do using Hawk credentials from step 3):</div>
<div style="font-size:12.8000001907349px">4a)
Call <a moz-do-not-send="true"
href="https://github.com/mozilla/fxa-auth-server/blob/master/docs/api.md#get-v1sessionstatus"
target="_blank">https://github.com/mozilla/fxa-auth-server/blob/master/docs/api.md#get-v1sessionstatus</a> to
get session status</div>
<div style="font-size:12.8000001907349px">5b)
Call <a moz-do-not-send="true"
href="https://github.com/mozilla/fxa-auth-server/blob/master/docs/api.md#post-v1sessiondestroy"
target="_blank">https://github.com/mozilla/fxa-auth-server/blob/master/docs/api.md#post-v1sessiondestroy</a> to
destroy session</div>
<div style="font-size:12.8000001907349px"><br>
</div>
<div style="font-size:12.8000001907349px">What I
want be able to do using Hawk credentials from
step 3)</div>
<div style="font-size:12.8000001907349px">
<div>4b) Call <a moz-do-not-send="true"
href="https://docs.services.mozilla.com/loop/apis.html#post-call-url"
target="_blank">https://docs.services.mozilla.com/loop/apis.html#post-call-url</a> to
get call url</div>
<div>But the only thing I receive from Loop
Server:</div>
<div>
<div><font size="1">{</font></div>
<div><font size="1"><span
style="white-space:pre-wrap"> </span>"code":
401,</font></div>
<div><font size="1"><span
style="white-space:pre-wrap"> </span>"errno":
110,</font></div>
<div><font size="1"><span
style="white-space:pre-wrap"> </span>"error":
{</font></div>
<div><font size="1"><span
style="white-space:pre-wrap"> </span>"statusCode":
401,</font></div>
<div><font size="1"><span
style="white-space:pre-wrap"> </span>"error":
"Unauthorized",</font></div>
<div><font size="1"><span
style="white-space:pre-wrap"> </span>"message":
"Unknown credentials"</font></div>
<div><font size="1"><span
style="white-space:pre-wrap"> </span>}</font></div>
<div><font size="1">}</font></div>
</div>
<div><br>
</div>
<div>So I here are more concrete questions:</div>
<div>- is it even possible to call <a
moz-do-not-send="true"
href="https://docs.services.mozilla.com/loop/apis.html#post-call-url"
target="_blank">https://docs.services.mozilla.com/loop/apis.html#post-call-url</a> with
hawk credentials derived from session token
recieved from <a moz-do-not-send="true"
href="https://github.com/mozilla/fxa-auth-server/blob/master/docs/api.md#post-v1accountlogin"
target="_blank">https://github.com/mozilla/fxa-auth-server/blob/master/docs/api.md#post-v1accountlogin</a>?</div>
<div>- if it is possible - what I am doing
wrong?</div>
<div>- if it is not possible - what are other
ways? (except FxA OAuth)</div>
<div><br>
</div>
<div>P.S. I create test application to give an
idea what I am doing: <a
moz-do-not-send="true"
href="https://github.com/oleksandrkyetov/test-app-server"
target="_blank">https://github.com/oleksandrkyetov/test-app-server</a></div>
<div><br>
Thanks in advance,</div>
<div>Alex K.</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</blockquote>
<br>
</body>
</html>