你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

Communication Identity - Issue Access Token

为标识颁发新令牌。

POST {endpoint}/identities/{id}/:issueAccessToken?api-version=2023-10-01

URI 参数

名称 必需 类型 说明
endpoint
path True

string

通信资源,例如 https://my-resource.communication.azure.com

id
path True

string

要为其颁发令牌的标识的标识符。

api-version
query True

string

要调用的 API 版本。

请求正文

名称 必需 类型 说明
scopes True

CommunicationIdentityTokenScope[]

附加到令牌的范围列表。

expiresInMinutes

integer

令牌在 [60,1440] 分钟范围内可选的自定义有效期。 如果未提供,将使用默认值 1440 分钟(24 小时)。

响应

名称 类型 说明
200 OK

CommunicationIdentityAccessToken

成功

Other Status Codes

CommunicationErrorResponse

错误

示例

Issue an access token. Optionally specify a custom expiration time within the [60-1440] minutes range. In case an expiration time is not specified, the default value of 1440 minutes (24 hours) will be used.

示例请求

POST https://my-resource.communication.azure.com/identities/8:acs:2dee53b4-368b-45b4-ab52-8493fb117652_00000005-14a2-493b-8a72-5a3a0d000081/:issueAccessToken?api-version=2023-10-01

{
  "scopes": [
    "chat",
    "voip",
    "chat.join",
    "chat.join.limited",
    "voip.join"
  ],
  "expiresInMinutes": 60
}

示例响应

{
  "token": "token",
  "expiresOn": "2023-10-10T21:39:39.3244584+00:00"
}

定义

名称 说明
CommunicationError

通信服务错误。

CommunicationErrorResponse

通信服务错误。

CommunicationIdentityAccessToken

访问令牌。

CommunicationIdentityAccessTokenRequest
CommunicationIdentityTokenScope

访问令牌的范围列表。

CommunicationError

通信服务错误。

名称 类型 说明
code

string

错误代码。

details

CommunicationError[]

有关导致此错误的特定错误的更多详细信息。

innererror

CommunicationError

内部错误(如果有)。

message

string

错误消息。

target

string

错误目标。

CommunicationErrorResponse

通信服务错误。

名称 类型 说明
error

CommunicationError

通信服务错误。

CommunicationIdentityAccessToken

访问令牌。

名称 类型 说明
expiresOn

string

令牌的到期时间。

token

string

为标识颁发的访问令牌。

CommunicationIdentityAccessTokenRequest

名称 类型 默认值 说明
expiresInMinutes

integer

1440

令牌在 [60,1440] 分钟范围内可选的自定义有效期。 如果未提供,将使用默认值 1440 分钟(24 小时)。

scopes

CommunicationIdentityTokenScope[]

附加到令牌的范围列表。

CommunicationIdentityTokenScope

访问令牌的范围列表。

名称 类型 说明
chat

string

使用此选项可完全访问聊天 API。

chat.join

string

访问聊天 API,但无权创建、删除或更新聊天线程。

chat.join.limited

string

不允许添加或删除参与者的 chat.join 版本更有限。 当令牌持有者不完全受信任(例如在来宾方案中)时,请使用此范围。

voip

string

使用此选项可以完全访问调用 API。

voip.join

string

访问调用 API,但无权启动新调用。