[英]GET JWT Bearer token for Azure Web PubSub Rest API to authenticate
I am working on a project, in which I am building a publish-subscribe system through Azure Web PubSub Service.我正在做一个项目,我正在通过 Azure Web PubSub Service 构建一个发布-订阅系统。 The JavaScript clients (subscribers) are connected through socket and able to receive the published message on the Hub and in the Group.
JavaScript 客户端(订阅者)通过套接字连接,并能够在 Hub 和 Group 中接收发布的消息。 For this I followed this tutorial: https://docs.microsoft.com/en-us/azure/azure-web-pubsub/tutorial-pub-sub-messages?tabs=javascript
为此,我遵循了本教程: https ://docs.microsoft.com/en-us/azure/azure-web-pubsub/tutorial-pub-sub-messages?tabs=javascript
Everything is working fine, as I am in the POC phase yet.一切正常,因为我还处于 POC 阶段。 So currently I am publishing messages through JavaScript from above tutorial.
所以目前我正在通过上述教程中的 JavaScript 发布消息。 But now I am starting to integrate it in my existing app which is developed in PHP.
但现在我开始将它集成到我现有的用 PHP 开发的应用程序中。 So I am thinking to use following Azure REST API for Web PubSub operation: https://docs.microsoft.com/en-us/rest/api/webpubsub/dataplane/web-pub-sub
所以我正在考虑使用以下 Azure REST API 进行 Web PubSub 操作: https ://docs.microsoft.com/en-us/rest/api/webpubsub/dataplane/web-pub-sub
Before this I worked on the Azure Graph APIs, in which I did an App Registration at Azure Portal with some Redirect URLs, and assign some permissions to access the resources.在此之前,我从事 Azure Graph API 的工作,其中我在 Azure 门户上使用一些重定向 URL 进行了应用程序注册,并分配了一些访问资源的权限。 I did this for Outlook Mail, Overdrive, SharePoint and its very straight forward process to get the access token (JWT) to access the resources.
我为 Outlook Mail、Overdrive、SharePoint 及其非常直接的过程执行此操作,以获取访问令牌 (JWT) 以访问资源。
But I am stuck and unable to get the access token for Azure Web PubSub API.但我被卡住了,无法获取 Azure Web PubSub API 的访问令牌。 I need token to just Publish a message from PHP end by REST API.
我需要令牌才能通过 REST API 从 PHP 端发布消息。 I checked in App Registration's > API permissions section, there is no permission for the Azure Web PubSub Service.
我检查了应用注册的 > API 权限部分,没有 Azure Web PubSub 服务的权限。 I checked the same app in Enterprise application also.
我也在企业应用程序中检查了相同的应用程序。 Did some hit and try, but didn't get the access token.
做了一些尝试,但没有获得访问令牌。 I know the issue is with the permission.
我知道问题出在许可上。
Please help me to get the token for this, so will call the Web PubSub API, Or if I am missing something please help me to trace.请帮我获取令牌,以便调用 Web PubSub API,或者如果我遗漏了什么,请帮助我追踪。 Any suggestion are welcome.
欢迎任何建议。 Thanks.
谢谢。
I think you can make use of the following REST API endpoints:我认为您可以使用以下 REST API 端点:
https://docs.microsoft.com/en-us/rest/api/webpubsub/dataplane/web-pub-sub/grant-permission#webpubsubpermission
https://docs.microsoft.com/en-us/rest/api/webpubsub/dataplane/web-pub-sub/grant-permission#webpubsubpermission
https://docs.microsoft.com/en-us/rest/api/webpubsub/dataplane/web-pub-sub/generate-client-token
https://docs.microsoft.com/en-us/rest/api/webpubsub/dataplane/web-pub-sub/generate-client-token
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.