Azure / Azure/azure-webpubsub

Integrate with API Management

Open
#194 0 comments 0 reactions 0 assignees View on GitHub
sdk-csharp sdk-java sdk-js sdk-python
Dominant language
TypeScript
Stars
147
Forks
96
Avg merge
19h 28m
Merged PRs (30d)
87

Description

### Feature requirement
It requires SDK support when invoking REST API: to successfully call Web PubSub through APIM, the request URL should be the APIM URL, while the `aud` of JWT token should be Web PubSub URL.

![image](https://user-images.githubusercontent.com/668244/124237101-c1799b80-db49-11eb-9849-231ba764b0ab.png)

### How to integrate with API Management service
1. Create the API Management service using default settings following https://docs.microsoft.com/en-us/azure/api-management/get-started-create-service-instance
2. Go to **APIs** => **Create from definition** => **OpenAPI**
a. OpenAPI specification: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/specification/webpubsub/data-plane/WebPubSub/preview/2021-05-01-preview/webpubsub.json
b. **Create**
![image](https://user-images.githubusercontent.com/668244/124236310-e0c3f900-db48-11eb-90dd-4441bb4fa432.png)

3. Settings
a. set **Web service URL** to the **Web PubSub service URL**: `https://xxxx.webpubsub.azure.com`
b. **Uncheck** **Subscription required** (for quick test purpose)
c. Others remain default settings
d. **Save**
![image](https://user-images.githubusercontent.com/668244/124236570-284a8500-db49-11eb-987c-1a5e579bc1d1.png)

4. All set, now let's test the API
a. Use the **Test** tab, choose the API `HEAD Get service health status.` which does not require Auth, it should return Response 200 OK
![image](https://user-images.githubusercontent.com/668244/124236763-5fb93180-db49-11eb-851d-f5421ddabb8b.png)

b. Test if the API Management service works, try using the **APIM URL** `https://xxxx.azure-api.net` to invoke the health check:
In terminal,
```batch
curl https://xxxx.azure-api.net/api/health?api-version=2021-05-01-preview --head
```
It should return **HTTP/1.1 200 OK**

Contributor guide

No contributing guide indexed for this repository

Research direction

No source file or test is named. Start by locating the TypeScript SDK entry points for REST invocation and JWT generation, then reproduce the APIM setup and health check described in the issue. Done means requests use the APIM URL while the JWT aud remains the Web PubSub service URL.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, typescript
Domain
api
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.