你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
Communication Identity - Create
创建新的标识(可选)访问令牌。
POST {endpoint}/identities?api-version=2023-10-01
URI 参数
名称 | 在 | 必需 | 类型 | 说明 |
---|---|---|---|---|
endpoint
|
path | True |
string |
|
api-version
|
query | True |
string |
要调用的 API 版本。 |
请求正文
名称 | 类型 | 说明 |
---|---|---|
createTokenWithScopes |
此外,为创建的标识创建访问令牌。 |
|
expiresInMinutes |
integer |
令牌在 [60,1440] 分钟范围内可选的自定义有效期。 如果未提供,将使用默认值 1440 分钟(24 小时)。 |
响应
名称 | 类型 | 说明 |
---|---|---|
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"
}
}
定义
名称 | 说明 |
---|---|
Communication |
通信服务错误。 |
Communication |
通信服务错误。 |
Communication |
通信标识。 |
Communication |
访问令牌。 |
Communication |
具有访问令牌的通信标识。 |
Communication |
|
Communication |
访问令牌的范围列表。 |
CommunicationError
通信服务错误。
名称 | 类型 | 说明 |
---|---|---|
code |
string |
错误代码。 |
details |
有关导致此错误的特定错误的更多详细信息。 |
|
innererror |
内部错误(如果有)。 |
|
message |
string |
错误消息。 |
target |
string |
错误目标。 |
CommunicationErrorResponse
通信服务错误。
名称 | 类型 | 说明 |
---|---|---|
error |
通信服务错误。 |
CommunicationIdentity
通信标识。
名称 | 类型 | 说明 |
---|---|---|
id |
string |
标识的标识符。 |
CommunicationIdentityAccessToken
访问令牌。
名称 | 类型 | 说明 |
---|---|---|
expiresOn |
string |
令牌的到期时间。 |
token |
string |
为标识颁发的访问令牌。 |
CommunicationIdentityAccessTokenResult
具有访问令牌的通信标识。
名称 | 类型 | 说明 |
---|---|---|
accessToken |
访问令牌。 |
|
identity |
通信标识。 |
CommunicationIdentityCreateRequest
名称 | 类型 | 默认值 | 说明 |
---|---|---|---|
createTokenWithScopes |
此外,为创建的标识创建访问令牌。 |
||
expiresInMinutes |
integer |
1440 |
令牌在 [60,1440] 分钟范围内可选的自定义有效期。 如果未提供,将使用默认值 1440 分钟(24 小时)。 |
CommunicationIdentityTokenScope
访问令牌的范围列表。
名称 | 类型 | 说明 |
---|---|---|
chat |
string |
使用此选项可完全访问聊天 API。 |
chat.join |
string |
访问聊天 API,但无权创建、删除或更新聊天线程。 |
chat.join.limited |
string |
不允许添加或删除参与者的 chat.join 版本更有限。 当令牌持有者不完全受信任(例如在来宾方案中)时,请使用此范围。 |
voip |
string |
使用此选项可以完全访问调用 API。 |
voip.join |
string |
访问调用 API,但无权启动新调用。 |