<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Set Authorization headers for backend requests(solved)]]></title><description><![CDATA[<p>Is it possible to add Authorization headers to all outgoing request from colyseus/Client (ts implementation)?<br />
I have an API gateway that's secured through OpenID-Connect and would like to move my colyseus server behind it so I can use the same users as for my other services.<br />
In the official documentation I've only found the possibility to add an accessToken for an FB login on the .login() method but maybe I've missed something.<br />
Specifically I'm wondering about the POST to /matchmake as well as the GET for the session.</p>
<p>Thank you very much for this great tool and your assistance!</p>
]]></description><link>http://discuss.colyseus.io/topic/586/set-authorization-headers-for-backend-requests-solved</link><generator>RSS for Node</generator><lastBuildDate>Thu, 12 Mar 2026 16:29:25 GMT</lastBuildDate><atom:link href="http://discuss.colyseus.io/topic/586.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 28 Feb 2022 13:20:49 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Set Authorization headers for backend requests(solved) on Wed, 02 Mar 2022 15:26:44 GMT]]></title><description><![CDATA[<p>Is it possible to add Authorization headers to all outgoing request from colyseus/Client (ts implementation)?<br />
I have an API gateway that's secured through OpenID-Connect and would like to move my colyseus server behind it so I can use the same users as for my other services.<br />
In the official documentation I've only found the possibility to add an accessToken for an FB login on the .login() method but maybe I've missed something.<br />
Specifically I'm wondering about the POST to /matchmake as well as the GET for the session.</p>
<p>Thank you very much for this great tool and your assistance!</p>
]]></description><link>http://discuss.colyseus.io/post/1747</link><guid isPermaLink="true">http://discuss.colyseus.io/post/1747</guid><dc:creator><![CDATA[legendariusx]]></dc:creator><pubDate>Wed, 02 Mar 2022 15:26:44 GMT</pubDate></item><item><title><![CDATA[Reply to Set Authorization headers for backend requests(solved) on Mon, 28 Feb 2022 16:06:14 GMT]]></title><description><![CDATA[<p>Hey probably kinda depends on the specific setup you have.<br />
But in the room in the &quot;onAuth()&quot; callback you can access the header via the request object you get.<br />
so on client side set the header with your accessToken<br />
<a href="https://docs.colyseus.io/colyseus/server/room/#onauth-client-options-request" rel="nofollow">https://docs.colyseus.io/colyseus/server/room/#onauth-client-options-request</a></p>
<p>then for /matchmake or sessions endpoints i would add a express middleware<br />
<a href="https://expressjs.com/en/guide/using-middleware.html" rel="nofollow">https://expressjs.com/en/guide/using-middleware.html</a></p>
<p>this would work if you use the express setup for the colyseus server:<br />
<a href="https://docs.colyseus.io/colyseus/server/api/#optionsserver" rel="nofollow">https://docs.colyseus.io/colyseus/server/api/#optionsserver</a></p>
<p>also you have have to set on client side the header with some sort of intercepter<br />
this doc helps if you develop you client for the web:<br />
<a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/webRequest" rel="nofollow">https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/webRequest</a></p>
]]></description><link>http://discuss.colyseus.io/post/1748</link><guid isPermaLink="true">http://discuss.colyseus.io/post/1748</guid><dc:creator><![CDATA[Wenish]]></dc:creator><pubDate>Mon, 28 Feb 2022 16:06:14 GMT</pubDate></item><item><title><![CDATA[Reply to Set Authorization headers for backend requests(solved) on Invalid Date]]></title><description><![CDATA[<p>Hey, thank you very much for replying to my question.<br />
The last link you provided would be what I'm looking for but it seems this is only possible for browser Add-ons and not a web application.<br />
I looked at the colyseus.js Client implementation <a href="https://github.com/colyseus/colyseus.js/blob/master/src/Client.ts" rel="nofollow">https://github.com/colyseus/colyseus.js/blob/master/src/Client.ts</a> and it seems like the package used is httpie which is very lightweight but does not provide interception (possibility to add headers before any request is sent).</p>
<p>So here's what I'm trying to do:<br />
<img src="/assets/uploads/files/1646085516667-colyseus_authorization_use_case-resized.png" alt="0_1646085515428_colyseus_authorization_use_case.png" class="img-responsive img-markdown" /></p>
<p>For this to be possible, the authorization needs to happen when the request gets to the API gateway. This means that the Authorization header would need to be present on the POST to /matchmake as well as the subsequent GET where the session is requested.</p>
<p>This use case does not seem to be possible with the current implementation of the colyseus.js package.<br />
Are you interested in providing this functionality, i.E. is this something that warrants a feature request/PR?</p>
]]></description><link>http://discuss.colyseus.io/post/1749</link><guid isPermaLink="true">http://discuss.colyseus.io/post/1749</guid><dc:creator><![CDATA[legendariusx]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to Set Authorization headers for backend requests(solved) on Invalid Date]]></title><description><![CDATA[<p>true i sent a link to add-ons. i meant to sent a link for service workers<br />
<a href="https://stackoverflow.com/questions/43813770/how-to-intercept-all-http-requests-including-form-submits#:~:text=js%20file%20(the%20actual%20service,function(event)%20%7B%20event" rel="nofollow">https://stackoverflow.com/questions/43813770/how-to-intercept-all-http-requests-including-form-submits#:~:text=js file (the actual service,function(event) { event</a>.</p>
]]></description><link>http://discuss.colyseus.io/post/1750</link><guid isPermaLink="true">http://discuss.colyseus.io/post/1750</guid><dc:creator><![CDATA[Wenish]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to Set Authorization headers for backend requests(solved) on Invalid Date]]></title><description><![CDATA[<p>Thank you!</p>
]]></description><link>http://discuss.colyseus.io/post/1751</link><guid isPermaLink="true">http://discuss.colyseus.io/post/1751</guid><dc:creator><![CDATA[legendariusx]]></dc:creator><pubDate>Invalid Date</pubDate></item></channel></rss>