No subject


Sun Mar 31 09:34:23 UTC 2013


terms of allowing cross-domain requests, in the after_request of store.py,
where the '/search' action lives (
https://github.com/okfn/annotator-store/blob/master/annotator/store.py).

Any ideas for what I can try to address this or to debug it further?

As an aside - is there a sandbox store available so that I don't have to
hit the real annotateit.org with all my test requests?

Thanks,
Rouan

--f46d040fa2744dc99904dc94e080
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><table class=3D"" cellpadding=3D"0" cellspacing=3D"0"><tbo=
dy class=3D" "><tr class=3D""><td class=3D""></td><td class=3D""><div class=
=3D""></div></td></tr></tbody></table>Hi all<div><br></div><div>I was hopin=
g someone could help me figure out CORS for my app. I&#39;m using=A0<h4 sty=
le=3D"margin:0px;padding:0px;border:0px">
<font color=3D"#333333" face=3D"Helvetica, arial, freesans, clean, sans-ser=
if"><span style=3D"line-height:18px">Annotator 1.2.6 <span style=3D"font-we=
ight:normal">with</span>=A0</span><span style=3D"font-weight:normal;line-he=
ight:18px"><a href=3D"http://annotateit.org">annotateit.org</a>=A0as my bac=
kend store.=A0I get the error below when loading a page that uses annotator=
.</span></font></h4>
<br>In Chrome:=A0</div><div><span style=3D"font-family:Menlo,monospace;font=
-size:11px;white-space:pre-wrap"><font color=3D"#ff0000">XMLHttpRequest can=
not load </font><a href=3D"http://annotateit.org/api/search?uri=3Dhttp%3A%2=
F%2Flocalhost%3A3000%2Fpoems%2F404" class=3D"" title=3D"http://annotateit.o=
rg/api/search?uri=3Dhttp%3A%2F%2Flocalhost%3A3000%2Fpoems%2F404" target=3D"=
_blank" style=3D"color:rgb(84,84,84);text-decoration:none">http://annotatei=
t.org/api/search?uri=3D</a><i><font color=3D"#000000">&lt;my-uri&gt;</font>=
</i><font color=3D"#ff0000">. Origin </font><a href=3D"http://localhost/" c=
lass=3D"" title=3D"http://localhost" target=3D"_blank" style=3D"color:rgb(8=
4,84,84);text-decoration:none">http://localhost:3000</a><font color=3D"#ff0=
000"> is not allowed by Access-Control-Allow-Origin.</font></span><span sty=
le=3D"color:rgb(255,0,0);font-family:Menlo,monospace;font-size:11px;white-s=
pace:pre-wrap"> </span><br>
<div><br></div><div style>In Firefox the error is less descriptive:</div><d=
iv style><span class=3D"">&quot;NetworkError: 500 Internal Server Error - <=
a href=3D"http://annotateit.org/api/search?uri=3D">http://annotateit.org/ap=
i/search?uri=3D</a>&lt;my-uri&gt;&quot;</span><br>
</div><div style><br></div><div style>I&#39;ve tried this on localhost, usi=
ng <a href=3D"http://lvh.me">http://lvh.me</a> and on my staging environmen=
t - all with the same results.</div><div><br></div><div style>My javascript=
 looks something like this:</div>
<div style><br></div><div style><blockquote class=3D"gmail_quote" style=3D"=
margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,20=
4,204);border-left-style:solid;padding-left:1ex">jQuery(function ($) {<br><=
span class=3D"" style=3D"white-space:pre">	</span>$(&#39;.annotated-content=
&#39;).annotator()<br>
<span class=3D"" style=3D"white-space:pre">		</span>.annotator(&#39;setupPl=
ugins&#39;, {}, {<br>=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0Tags: false,<br=
>=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0Filter: false,<br>=A0 =A0 =A0 =A0 =
=A0 =A0 =A0 =A0 =A0 =A0Auth: {tokenUrl: &#39;/auth/token&#39;}<br>
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0});<br>});</blockquote><div><br></div><d=
iv style>And I&#39;ve implemented the auth/token endpoint like this (Rails)=
:</div><div style><br></div><div style><blockquote class=3D"gmail_quote" st=
yle=3D"margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb=
(204,204,204);border-left-style:solid;padding-left:1ex">
=A0 def token<br><span class=3D"" style=3D"white-space:pre">	 </span>render=
 :json =3D&gt; JWT.encode({<br><span class=3D"" style=3D"white-space:pre">	=
</span> =A0 =A0:consumerKey =3D&gt; CONSUMER_KEY,<br><span class=3D"" style=
=3D"white-space:pre">	</span> =A0 =A0:userId =3D&gt; session[:user_id],<br>
<span class=3D"" style=3D"white-space:pre">	</span> =A0 =A0:issuedAt =3D&gt=
; Time.now.utc.iso8601,<br><span class=3D"" style=3D"white-space:pre">	</sp=
an> =A0 =A0:ttl =3D&gt; CONSUMER_TTL<br><span class=3D"" style=3D"white-spa=
ce:pre">	</span> =A0}, CONSUMER_SECRET)<br>
=A0 end</blockquote></div></div><div><br></div><div style>From what I can t=
ell, the annotator store is doing what it&#39;s meant to do in terms of all=
owing cross-domain requests, in the=A0<span style=3D"color:rgb(153,0,0);fon=
t-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;font-size:12p=
x;font-weight:bold;line-height:18px;white-space:pre">after_request </span>o=
f store.py, where the &#39;/search&#39; action lives (<a href=3D"https://gi=
thub.com/okfn/annotator-store/blob/master/annotator/store.py">https://githu=
b.com/okfn/annotator-store/blob/master/annotator/store.py</a>).</div>
<div style><br></div><div style>Any ideas for what I can try to address thi=
s or to debug it further?</div><div style><br></div><div>As an aside - is t=
here a sandbox store available so that I don&#39;t have to hit the real <a =
href=3D"http://annotateit.org">annotateit.org</a>=A0with all my test reques=
ts?</div>
</div><div><br></div><div style>Thanks,</div><div style>Rouan</div></div>

--f46d040fa2744dc99904dc94e080--



More information about the annotator-dev mailing list