You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/azure-web-pubsub/howto-generate-client-access-url.md
+13-13Lines changed: 13 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,14 +11,14 @@ ms.topic: how-to
11
11
12
12
# How to generate client access URL for the clients
13
13
14
-
A client, be it a browser 💻, a mobile app 📱, or an IoT device 💡, uses a **Client Access URL** to connect and authenticate with your resource. This URL follows a pattern of `wss://<service_name>.webpubsub.azure.com/client/hubs/<hub_name>?access_token=<token>`. This artcile shows you several ways to get the Client Access URL.
14
+
A client, be it a browser 💻, a mobile app 📱, or an IoT device 💡, uses a **Client Access URL** to connect and authenticate with your resource. This URL follows a pattern of `wss://<service_name>.webpubsub.azure.com/client/hubs/<hub_name>?access_token=<token>`. This article shows you several ways to get the Client Access URL.
15
15
16
16
- For quick start, copy one from the Azure portal
17
17
- For development, generate the value using [Web PubSub server SDK](./reference-server-sdk-js.md)
18
-
- If you are using Azure AD, you can also invoke the [Generate Client Token REST API](/rest/api/webpubsub/dataplane/web-pub-sub/generate-client-token)
18
+
- If you're using Azure AD, you can also invoke the [Generate Client Token REST API](/rest/api/webpubsub/dataplane/web-pub-sub/generate-client-token)
19
19
20
20
## Copy from the Azure portal
21
-
In the Keys tab in Azure portal, there is a Client URL Generator tool to quickly generate a Client Access URL for you, as shown in the following diagram. Please note that values input here are not stored.
21
+
In the Keys tab in Azure portal, there's a Client URL Generator tool to quickly generate a Client Access URL for you, as shown in the following diagram. Values input here aren't stored.
22
22
23
23

24
24
@@ -46,7 +46,7 @@ The same Client Access URL can be generated by using the Web PubSub server SDK.
46
46
```js
47
47
let token = await serviceClient.getClientAccessToken({ roles: ["webpubsub.sendToGroup.group1"] });
48
48
```
49
-
* Configure a group `group1` that the client will join once it connects using this Client Access URL
49
+
* Configure a group `group1` that the client joins once it connects using this Client Access URL
50
50
```js
51
51
let token = await serviceClient.getClientAccessToken({ groups: ["group1"] });
52
52
```
@@ -72,7 +72,7 @@ The same Client Access URL can be generated by using the Web PubSub server SDK.
72
72
```csharp
73
73
var url = service.GetClientAccessUri(roles: new string[] { "webpubsub.sendToGroup.group1" });
74
74
```
75
-
* Configure a group `group1` that the client will join once it connects using this Client Access URL
75
+
* Configure a group `group1` that the client joins once it connects using this Client Access URL
76
76
```csharp
77
77
var url = service.GetClientAccessUri(groups: new string[] { "group1" });
78
78
```
@@ -98,7 +98,7 @@ The same Client Access URL can be generated by using the Web PubSub server SDK.
In real-world code, we usually have a server side to host the logic generating the Client Access URL. When a client request comes in, the server side can leverage the general authentication/authorization workflow to validate the client request. Only valid client requests can get the Client Access URL back.
143
+
In real-world code, we usually have a server side to host the logic generating the Client Access URL. When a client request comes in, the server side can use the general authentication/authorization workflow to validate the client request. Only valid client requests can get the Client Access URL back.
144
144
145
145
## Invoke the Generate Client Token RESTAPI
146
146
147
-
You can enable Azure ADin your service and use the AAD token to invoke [Generate Client Token rest API](/rest/api/webpubsub/dataplane/web-pub-sub/generate-client-token) to get the token for the client to use.
147
+
You can enable Azure ADin your service and use the Azure AD token to invoke [Generate Client Token rest API](/rest/api/webpubsub/dataplane/web-pub-sub/generate-client-token) to get the token for the client to use.
148
148
149
149
1. Follow [Authorize from application](./howto-authorize-from-application.md) to enable Azure AD.
150
-
2. Get the AAD token with Postman:
150
+
2. Get the Azure AD token with Postman:
151
151
1. For the URI, enter `https://login.microsoftonline.com/<TENANT ID>/oauth2/token`. Replace`<TENANT ID>`with the **Directory (tenant) ID value**in the **Overview** tab of the application you created earlier.
152
152
2. On the **Headers** tab, add **Content-Type** key and `application/x-www-form-urlencoded`for the value.
153
153
3. Switch to the **Body** tab, and add the following keys and values.
@@ -156,13 +156,13 @@ You can enable Azure AD in your service and use the AAD token to invoke [Generat
156
156
3. Add `client_id` key, and paste the value of**Application (client) ID**in the **Overview** tab of the application you created earlier.
157
157
4. Add `client_secret` key, and paste the value of client secret you noted down earlier.
158
158
5. Add `resource` key, and type `https://webpubsub.azure.com`for the value.
159
-
4. Select **Send** to send the request to get the token. You see the AAD token in the `access_token` field.
159
+
4. Select **Send** to send the request to get the token. You see the Azure AD token in the `access_token` field.
160
160
161
161

162
162
163
-
3. Use the AAD token to invoke `:generateToken`with Postman:
163
+
3. Use the Azure AD token to invoke `:generateToken`with Postman:
164
164
1. For the URI, enter `https://{Endpoint}/api/hubs/{hub}/:generateToken?api-version=2022-11-01`
165
-
2. On the **Auth** tab, select **Bearer Token** and paste the AAD token fetched in the previous step
165
+
2. On the **Auth** tab, select **Bearer Token** and paste the Azure AD token fetched in the previous step
166
166
3. Select **Send** and you see the Client Access Token in the response:
0 commit comments