Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UX Turbo Mercure - Basic config returns 401 #84

Closed
jmsche opened this issue Apr 19, 2021 · 2 comments
Closed

UX Turbo Mercure - Basic config returns 401 #84

jmsche opened this issue Apr 19, 2021 · 2 comments

Comments

@jmsche
Copy link
Contributor

jmsche commented Apr 19, 2021

Hi,

I've tried last week to set up a demo project, as simple as possible, to try UX Turbo with Mercure.

Unfortunately, I can't find a way to make this work.
The best I managed to get is a 401 Unauthorized response when the browser tries to connect to the Mercure server, while I seem to manage to connect to it correctly in my terminal using curl.

Here is the reproducer: https://github.com/jmsche/turbo-reproducer
You can read its README to launch it "easily" (using Symfony CLI & Docker Compose).

What I noted though: I don't see any token passed to the XHR request sent to Mercure.

Here is the request I got from Firefox (using right click on the request => copy as curl):

curl 'http://127.0.0.1:3010/.well-known/mercure?topic=chat' -H 'User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:87.0) Gecko/20100101 Firefox/87.0' -H 'Accept: text/event-stream' -H 'Accept-Language: fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3' --compressed -H 'Origin: https://127.0.0.1:8000' -H 'Connection: keep-alive' -H 'Pragma: no-cache' -H 'Cache-Control: no-cache'

As you can see the request is sent to the correct URL/port; so Symfony CLI does not seem to be the issue here.

@dunglas
Copy link
Member

dunglas commented Apr 30, 2021

The problem is that you currently try to use an external hub while also using Symfony CLI. You need to use the built-in hub provided by Symfony CLI and the JWT key must be the default one (!ChangeMe!).

See https://github.com/symfony/cli/issues/424 for more details and a workaround.

@chalasr
Copy link
Member

chalasr commented Sep 24, 2021

The Symfony CLI built-in mercure hub has been removed (see https://github.com/symfony/cli/issues/449).

@chalasr chalasr closed this as completed Sep 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants