mercure icon indicating copy to clipboard operation
mercure copied to clipboard

Tokenprovider is not working with Authorization class

Open alexz707 opened this issue 1 year ago • 0 comments

Hello :)

I'm trying to use the bundle with a custom tokenprovider which is working for one part. So I have my tokenprovider which collects all subscribeable and publishable topics and creates a token with it.

That's working fine for the backend.

For the Client I wanted to send a cookie with a token and had a look at the Authorization class.

I would like to use it but it's not compatible with the token provider. I mean it would use a TokenFactory but not a Provider.

public function createCookie(Request $request, $subscribe = [], $publish = [], array $additionalClaims = [], ?string $hub = null): Cookie

I can generate a new cookie but I need all the topics again and it's not using my token provider.

I then thought of creating the cookie myself but then I can't use the MERCURE_AUTHORIZATION_COOKIE_NAME as it's private.

Maybe I've missed something but should't it be possible to use a service which implements TokenProviderInterface with the Authorization class too?

Thanks & best Alex

alexz707 avatar Jun 20 '24 12:06 alexz707