api: improve sync hub auth

This commit is contained in:
Abdullah Atta
2025-09-26 09:29:07 +05:00
committed by Abdullah Atta
parent 44a9ff57e7
commit b3dcdda697
4 changed files with 13 additions and 18 deletions
+6 -2
View File
@@ -137,9 +137,13 @@ namespace Notesnook.API
options.DiscoveryPolicy.RequireHttps = false;
options.TokenRetriever = new Func<HttpRequest, string>(req =>
{
if (req.Path == "/hubs/sync/v2")
{
var fromQuery = TokenRetrieval.FromQueryString(); //needed for signalr and ws/wss conections to be authed via jwt
return fromQuery(req);
}
var fromHeader = TokenRetrieval.FromAuthorizationHeader();
var fromQuery = TokenRetrieval.FromQueryString(); //needed for signalr and ws/wss conections to be authed via jwt
return fromHeader(req) ?? fromQuery(req);
return fromHeader(req);
});
options.Events.OnTokenValidated = (context) =>