Movatterモバイル変換


[0]ホーム

URL:


Skip to main content

This browser is no longer supported.

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

Download Microsoft EdgeMore info about Internet Explorer and Microsoft Edge
Table of contentsExit editor mode

OAuth 2.0 JSON Web Token (JWT) authentication and authorization to publish or subscribe to MQTT messages

Feedback

In this article

You can authenticate MQTT clients with OAuth 2.0 JWT to connect to the Event Grid namespace. You can embed and validate custom claims in the JWT to authorize publish or subscribe permissions to your Event Grid topic spaces.

Important

This feature is supported only when using the MQTT v5 protocol version.

Prerequisites

Authentication using OAuth 2.0 JWT

You can use the MQTT v5 CONNECT packet to provide the OAuth 2.0 JWT to authenticate your client and the MQTT v5 AUTH packet to refresh the token.

Important

If you don't set the CONNECT packet's authentication method to CUSTOM-JWT, you receive an 'invalid issuer' error—even if all other configurations are correct.

In the CONNECT packet, you can provide the required values in the following fields:

FieldValue
Authentication MethodCUSTOM-JWT
Authentication DataJWT

In the AUTH packet, you can provide the required values in the following fields:

FieldValue
Authentication MethodCUSTOM-JWT
Authentication DataJWT
Authentication Reason Code25

Authenticate Reason Code with value 25 signifies reauthentication.

Note

Audience:aud claim must be set to[namespace][region]-1.ts.eventgrid.azure.net/.

Access permissions

A client using OAuth 2.0 JWT authentication can use client attributes and permissions to limit access to specific topics.

Next steps


Feedback

Was this page helpful?

YesNoNo

Need help with this topic?

Want to try using Ask Learn to clarify or guide you through this topic?

Suggest a fix?

  • Last updated on

In this article

Was this page helpful?

YesNo
NoNeed help with this topic?

Want to try using Ask Learn to clarify or guide you through this topic?

Suggest a fix?