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

[feat] Add support for MQTT 5 refresh auth #1795

Open
robertsLando opened this issue Feb 26, 2024 Discussed in #1794 · 0 comments
Open

[feat] Add support for MQTT 5 refresh auth #1795

robertsLando opened this issue Feb 26, 2024 Discussed in #1794 · 0 comments

Comments

@robertsLando
Copy link
Member

Specs: https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Re-authentication

Discussed in #1794

Originally posted by sseiber February 26, 2024
I'm using JWT Token authentication sucessfully by setting the mqtt client properties before connecting:

properties: {
    authenticationMethod: 'OAUTH2-JWT', // for Azure EventGrid
    authenticationData: <auth-token>
}

I need to be able to re-authenticate with the service when the token needs to be refreshed by sending an auth packet:

{
    cmd: 'auth',
    reasonCode: 0x19,
    properties: {
        authenticationMethod: 'OAUTH2-JWT',
        authenticationData: <auth-token>
    }
}

However, I don't see a way to send a specific packet. I'm following an example that uses MQTTnet to provide this functionality (see SendExtendedAuthenticationExchangeDataAsync):
https://github.com/dotnet/MQTTnet/blob/f82d382f23ec8388ed8a33c48b7ede08e2c18622/Source/MQTTnet/Client/MqttClient.cs#L296

Is there a method or standard pattern in mqtt.js for doing this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant