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

Unauthorized response with default config #53

Closed
vgomez-dataworks opened this issue Apr 20, 2021 · 4 comments
Closed

Unauthorized response with default config #53

vgomez-dataworks opened this issue Apr 20, 2021 · 4 comments

Comments

@vgomez-dataworks
Copy link

I installed mercure-bundle in my symfony with default values, just switched the URL of mercure to the my own.

Captura de Pantalla 2021-04-19 a la(s) 18 35 21

MERCURE_JWT_SECRET="!ChangeMe!"

And mercure is also running with default config.

SERVER_NAME=:3000 MERCURE_PUBLISHER_JWT_KEY='!ChangeMe!' MERCURE_SUBSCRIBER_JWT_KEY='!ChangeMe!' ./mercure run -config Caddyfile.dev

But i got an Unauthorized response

Captura de Pantalla 2021-04-19 a la(s) 18 32 16

Then i tested in many ways to get it working and finally i found the problem:

When I copy the Token to decode it, the expiration date appears to be in an incorrect format.

Captura de Pantalla 2021-04-19 a la(s) 18 39 24

If I remove the quotes, converting the string into decimal value, the expiration date appears to be correct.

Captura de Pantalla 2021-04-19 a la(s) 18 43 11

Finally I tested with both tokens, first the token generated by symphony and then with decimal expiration date.

Captura de Pantalla 2021-04-19 a la(s) 18 49 11

Mercure: 0.10.4 (Darwin)
Symfony: 5.2
Symfony mercure-bundle: 0.3.2

I don't know if it is a mistake done by me or is a real bug, i hope someone can help me.

Thanks

@vgomez-dataworks vgomez-dataworks changed the title Problem with default config Unauthorized response with default config Apr 20, 2021
@chalasr
Copy link
Member

chalasr commented Apr 20, 2021

Thanks for the detailed analysis and report.
Upgrading Mercure to v0.11.2 is likely to fix it, see https://github.com/dunglas/mercure/releases/tag/v0.11.2

@vgomez-dataworks
Copy link
Author

Sorry I made a mistake reporting the version of Mercure I am using, the problem is with version 0.11.2 Darwin.

@vgomez-dataworks
Copy link
Author

I finally found the problem, is related to an outdated version of the library lcobucci/jwt.

How can I force to download the correct version of lcobucci/jwt if i don't have the lcobucci/jwt in my composer.json?

@vgomez-dataworks
Copy link
Author

My problem was fixed with this commit:

lcobucci/jwt@9a961f4#diff-0d6f5466b75090a80363ed372e9a41012c30ba4d1eedc2ebc60c5a89716cf681

So I ran composer update "lcobucci/jwt"

And everything is working now

Thanks

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

2 participants