共用方式為


Communication Identity - Issue Access Token

為身分識別發出新的令牌。

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

URI 參數

名稱 位於 必要 類型 Description
endpoint
path True

string

通訊資源,例如 https://my-resource.communication.azure.com

id
path True

string

要發行令牌之身分識別的標識碼。

api-version
query True

string

要叫用的 API 版本。

要求本文

名稱 必要 類型 Description
scopes True

CommunicationIdentityTokenScope[]

附加至令牌的範圍清單。

expiresInMinutes

integer

令牌在 [60,1440] 分鐘範圍內選擇性的自定義有效期間。 如果未提供,則會使用預設值 1440 分鐘(24 小時)。

回應

名稱 類型 Description
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"
}

定義

名稱 Description
CommunicationError

通訊服務錯誤。

CommunicationErrorResponse

通訊服務錯誤。

CommunicationIdentityAccessToken

存取令牌。

CommunicationIdentityAccessTokenRequest
CommunicationIdentityTokenScope

存取令牌的範圍清單。

CommunicationError

通訊服務錯誤。

名稱 類型 Description
code

string

錯誤碼。

details

CommunicationError[]

導致此錯誤之特定錯誤的詳細數據。

innererror

CommunicationError

如果有,則為內部錯誤。

message

string

錯誤訊息。

target

string

錯誤目標。

CommunicationErrorResponse

通訊服務錯誤。

名稱 類型 Description
error

CommunicationError

通訊服務錯誤。

CommunicationIdentityAccessToken

存取令牌。

名稱 類型 Description
expiresOn

string

令牌的到期時間。

token

string

針對身分識別發出的存取令牌。

CommunicationIdentityAccessTokenRequest

名稱 類型 預設值 Description
expiresInMinutes

integer

1440

令牌在 [60,1440] 分鐘範圍內選擇性的自定義有效期間。 如果未提供,則會使用預設值 1440 分鐘(24 小時)。

scopes

CommunicationIdentityTokenScope[]

附加至令牌的範圍清單。

CommunicationIdentityTokenScope

存取令牌的範圍清單。

名稱 類型 Description
chat

string

使用此選項來完整存取聊天 API。

chat.join

string

存取聊天 API,但沒有建立、刪除或更新聊天線程的授權。

chat.join.limited

string

不允許新增或移除參與者的chat.join版本更有限。 當令牌持有人不完全信任時,請使用此範圍,例如在客體案例中。

voip

string

若要完整存取呼叫 API,請使用此選項。

voip.join

string

存取呼叫 API,但沒有啟動新話叫的授權。