Example of authenticate on subscription
hi all,
I've tried with example using axum and token from header with query and mutation works well. but I do not know how to do with subscription. Can you give a hint? thank you
I've tried with example token from header but it seems not work
@alexewsv For subscription is a little different. On the browser we can't set headers when creating a websocket connection. You can check this page for a more detailed explanation on it. So, for sending a token to a subscription you could send it as the initial parameters of the subscription. This is showed on this example. On the example we register the on_connection_init callback function. This function will be called when a new connections is created and will check the token
@alexewsv For subscription is a little different. On the browser we can't set headers when creating a websocket connection. You can check this page for a more detailed explanation on it. So, for sending a token to a subscription you could send it as the initial parameters of the subscription. This is showed on this example. On the example we register the
on_connection_initcallback function. This function will be called when a new connections is created and will check the token
Many thank your response. I'll check it soon.