@azure/communication-common 2.3.2-alpha.20250411.1 → 2.3.2-alpha.20250417.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -23
- package/package.json +3 -5
package/README.md
CHANGED
|
@@ -117,39 +117,44 @@ For scenarios where an Entra user can be used with Communication Services, you n
|
|
|
117
117
|
Along with this, you must provide the URI of the Azure Communication Services resource and the scopes required for the Entra user token. These scopes determine the permissions granted to the token.
|
|
118
118
|
If the scopes are not provided, by default, it sets the scopes to `https://communication.azure.com/clients/.default`.
|
|
119
119
|
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
tenantId: "<your-tenant-id>",
|
|
123
|
-
clientId: "<your-client-id>",
|
|
124
|
-
redirectUri: "<your-redirect-uri>",
|
|
125
|
-
};
|
|
126
|
-
const entraTokenCredential = new InteractiveBrowserCredential(options);
|
|
120
|
+
```ts snippet:ReadmeSampleCredentialEntraUser
|
|
121
|
+
import { AzureCommunicationTokenCredential } from "@azure/communication-common";
|
|
127
122
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
};
|
|
123
|
+
function fetchTokenFromMyServerForUser(user: string): Promise<string> {
|
|
124
|
+
// Your custom implementation to fetch a token for the user
|
|
125
|
+
return Promise.resolve("some-unique-token-for-" + user);
|
|
126
|
+
}
|
|
133
127
|
|
|
134
|
-
const
|
|
128
|
+
const tokenCredential = new AzureCommunicationTokenCredential({
|
|
129
|
+
tokenRefresher: async () => fetchTokenFromMyServerForUser("bob@contoso.com"),
|
|
130
|
+
refreshProactively: true,
|
|
131
|
+
token:
|
|
132
|
+
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjM2MDB9.adM-ddBZZlQ1WlN3pdPBOF5G4Wh9iZpxNP_fSvpF4cWs",
|
|
133
|
+
});
|
|
135
134
|
```
|
|
136
135
|
|
|
137
136
|
The same approach can be used for authorizing an Entra user with a Teams license to use Teams Phone Extensibility features through your Azure Communication Services resource.
|
|
138
137
|
This requires providing the `https://auth.msft.communication.azure.com/TeamsExtension.ManageCalls` scope.
|
|
139
138
|
|
|
140
|
-
```
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
139
|
+
```ts snippet:ReadmeSampleCredentialEntraUserTeamsPhoneExtensibility
|
|
140
|
+
import { InteractiveBrowserCredential } from "@azure/identity";
|
|
141
|
+
import {
|
|
142
|
+
EntraCommunicationTokenCredentialOptions,
|
|
143
|
+
AzureCommunicationTokenCredential,
|
|
144
|
+
} from "@azure/communication-common";
|
|
145
|
+
|
|
146
|
+
const options = {
|
|
147
|
+
tenantId: "<your-tenant-id>",
|
|
148
|
+
clientId: "<your-client-id>",
|
|
149
|
+
redirectUri: "<your-redirect-uri>",
|
|
150
|
+
};
|
|
146
151
|
const entraTokenCredential = new InteractiveBrowserCredential(options);
|
|
147
152
|
|
|
148
153
|
const entraTokenCredentialOptions: EntraCommunicationTokenCredentialOptions = {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
154
|
+
resourceEndpoint: "https://<your-resource>.communication.azure.com",
|
|
155
|
+
tokenCredential: entraTokenCredential,
|
|
156
|
+
scopes: ["https://auth.msft.communication.azure.com/TeamsExtension.ManageCalls"],
|
|
157
|
+
};
|
|
153
158
|
|
|
154
159
|
const credential = new AzureCommunicationTokenCredential(entraTokenCredentialOptions);
|
|
155
160
|
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@azure/communication-common",
|
|
3
|
-
"version": "2.3.2-alpha.
|
|
3
|
+
"version": "2.3.2-alpha.20250417.1",
|
|
4
4
|
"description": "Common package for Azure Communication services.",
|
|
5
5
|
"sdk-type": "client",
|
|
6
6
|
"main": "./dist/commonjs/index.js",
|
|
@@ -9,10 +9,8 @@
|
|
|
9
9
|
"browser": "./dist/browser/index.js",
|
|
10
10
|
"scripts": {
|
|
11
11
|
"build": "npm run clean && dev-tool run build-package && dev-tool run extract-api",
|
|
12
|
-
"build:
|
|
13
|
-
"build:
|
|
14
|
-
"build:samples": "echo Skipped.",
|
|
15
|
-
"build:test": "dev-tool run build-package && dev-tool run bundle",
|
|
12
|
+
"build:samples": "echo skipped.",
|
|
13
|
+
"build:test": "echo skipped.",
|
|
16
14
|
"check-format": "dev-tool run vendored prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"",
|
|
17
15
|
"clean": "dev-tool run vendored rimraf --glob dist dist-* temp types *.tgz *.log",
|
|
18
16
|
"execute:samples": "echo skipped",
|