Closed jonjon0815 closed 1 month ago
I have exactly the same issue.
I have also tried:
options.Headers.Add({"CF-Access-Client-Secret", "xxxxxx" );
Please tell me if you manage to get a work around working.
This is actually missing as a feature at the moment. It would just take a small adjustment to GetAuthHeaders
here. I’m away from my computer at the moment, so if you’re willing to PR, happy to have one!
This is actually missing as a feature at the moment. It would just take a small adjustment to
GetAuthHeaders
here. I’m away from my computer at the moment, so if you’re willing to PR, happy to have one!
I have made a PR: https://github.com/supabase-community/supabase-csharp/pull/168
The new version sems to have solved most of the issues I had, and I can set whatever custom header I need.
But for real time channels using the .On(ListenType.All, (sender, change) it seems it isn't sending the header. But I am still trying to locate if it is on client or server side this problem is located.
Since Realtime goes through Websockets, a header is only sent to establish an initial connection, it wouldn't be sent on every request
Yes I realized whenever I wrote it.
I looked into the realtime module.
From what I could tell the ws lib used is https://github.com/Marfusios/websocket-client
It has a SetRequestHeader method on ClientWebSocket.
But in the realtime module the WebsocketClient is used. I haven't spent the time figuring out the difference. But I just wanted to give me findings on the matter.
Oh! I apologize - I stand corrected. We actually don't pass any headers to the realtime client. All of the authorization is handled from inside the websocket connection. But that's a feature we can add in.
Available in 1.1.1
I am using the SupabasTables method .On
And it seems to be calling the ConnectAsync() method https://github.com/supabase-community/realtime-csharp/blob/973cdc20fa5d79438615f7b242d3268fef88de30/Realtime/Client.cs#L131
But it seems like the headers arn't getting applied from my testing. But I might be hitting the limitations of what is possible using headers and RLS.
RLS: (current_setting('request.headers'::text, true))::json ->> 'user_api_key'::text
I have set up a Supabase instance behind Cloudflare. Now I need to pass additional headers with every request. I already tried with the code above. This doesn't seem to be working. Does anyone have an idea how I could achieve this?