Communication Identity - Create
建立新的身分識別,並選擇性地建立存取令牌。
POST {endpoint}/identities?api-version=2023-10-01
URI 參數
名稱 | 位於 | 必要 | 類型 | Description |
---|---|---|---|---|
endpoint
|
path | True |
string |
|
api-version
|
query | True |
string |
要叫用的 API 版本。 |
要求本文
名稱 | 類型 | Description |
---|---|---|
createTokenWithScopes |
也為已建立的身分識別建立存取令牌。 |
|
expiresInMinutes |
integer |
令牌在 [60,1440] 分鐘範圍內選擇性的自定義有效期間。 如果未提供,則會使用預設值 1440 分鐘(24 小時)。 |
回應
名稱 | 類型 | Description |
---|---|---|
201 Created |
建立 - 傳回已建立的身分識別。 |
|
Other Status Codes |
錯誤 |
範例
Create an Identity and optionally an access token with custom expiration time within the [60-1440] minutes range. If expiration time is not specified, the default value of 1440 minutes (24 hours) will be used.
範例要求
POST https://my-resource.communication.azure.com/identities?api-version=2023-10-01
{
"createTokenWithScopes": [
"chat",
"voip",
"chat.join",
"chat.join.limited",
"voip.join"
],
"expiresInMinutes": 60
}
範例回覆
{
"identity": {
"id": "8:acs:2dee53b4-368b-45b4-ab52-8493fb117652_00000005-14a2-493b-8a72-5a3a0d000081"
},
"accessToken": {
"token": "token",
"expiresOn": "2023-10-10T21:39:39.3244584+00:00"
}
}
定義
名稱 | Description |
---|---|
Communication |
通訊服務錯誤。 |
Communication |
通訊服務錯誤。 |
Communication |
通訊身分識別。 |
Communication |
存取令牌。 |
Communication |
具有存取令牌的通訊身分識別。 |
Communication |
|
Communication |
存取令牌的範圍清單。 |
CommunicationError
通訊服務錯誤。
名稱 | 類型 | Description |
---|---|---|
code |
string |
錯誤碼。 |
details |
導致此錯誤之特定錯誤的詳細數據。 |
|
innererror |
如果有,則為內部錯誤。 |
|
message |
string |
錯誤訊息。 |
target |
string |
錯誤目標。 |
CommunicationErrorResponse
通訊服務錯誤。
名稱 | 類型 | Description |
---|---|---|
error |
通訊服務錯誤。 |
CommunicationIdentity
通訊身分識別。
名稱 | 類型 | Description |
---|---|---|
id |
string |
識別的標識碼。 |
CommunicationIdentityAccessToken
存取令牌。
名稱 | 類型 | Description |
---|---|---|
expiresOn |
string |
令牌的到期時間。 |
token |
string |
針對身分識別發出的存取令牌。 |
CommunicationIdentityAccessTokenResult
具有存取令牌的通訊身分識別。
名稱 | 類型 | Description |
---|---|---|
accessToken |
存取令牌。 |
|
identity |
通訊身分識別。 |
CommunicationIdentityCreateRequest
名稱 | 類型 | 預設值 | Description |
---|---|---|---|
createTokenWithScopes |
也為已建立的身分識別建立存取令牌。 |
||
expiresInMinutes |
integer |
1440 |
令牌在 [60,1440] 分鐘範圍內選擇性的自定義有效期間。 如果未提供,則會使用預設值 1440 分鐘(24 小時)。 |
CommunicationIdentityTokenScope
存取令牌的範圍清單。
名稱 | 類型 | Description |
---|---|---|
chat |
string |
使用此選項來完整存取聊天 API。 |
chat.join |
string |
存取聊天 API,但沒有建立、刪除或更新聊天線程的授權。 |
chat.join.limited |
string |
不允許新增或移除參與者的chat.join版本更有限。 當令牌持有人不完全信任時,請使用此範圍,例如在客體案例中。 |
voip |
string |
若要完整存取呼叫 API,請使用此選項。 |
voip.join |
string |
存取呼叫 API,但沒有啟動新話叫的授權。 |