'Send a jwt token in my SSE event source (subscribe request)

How can I send a jwt token (or a header (Authorization to be specific)) in my SSE subscription request (the event source)?

void subscribe (String jwtToken) async {
  final eventSource = await html.EventSource("http://127.0.0.1:8080/authenticated/sse_subscription");
  eventSource.addEventListener("myEvent", (event) => {print(event)});
}


Solution 1:[1]

Either cookies or url query string http://127.0.0.1:8080/authenticated/sse_subscription?jwt=userjwt

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Luis Rivera