Communication Identity - Exchange Teams User Access Token

Exchange an Azure Active Directory (Azure AD) access token of a Teams user for a new Communication Identity access token with a matching expiration time.

POST {endpoint}/teamsUser/:exchangeAccessToken?api-version=2023-10-01

URI Parameters

Name In Required Type Description
endpoint
path True

string

The communication resource, for example https://my-resource.communication.azure.com

api-version
query True

string

Version of API to invoke.

Request Body

Name Required Type Description
appId True

string

Client ID of an Azure AD application to be verified against the appid claim in the Azure AD access token.

token True

string

Azure AD access token of a Teams User to acquire a new Communication Identity access token.

userId True

string

Object ID of an Azure AD user (Teams User) to be verified against the oid claim in the Azure AD access token.

Responses

Name Type Description
200 OK

CommunicationIdentityAccessToken

Success

Other Status Codes

CommunicationErrorResponse

Error

Examples

Exchange a Teams user access token

Sample request

POST https://my-resource.communication.azure.com/teamsUser/:exchangeAccessToken?api-version=2023-10-01

{
  "token": "AzureActiveDirectoryAccessTokenOfATeamsUser",
  "appId": "2c3e1e83-8fd7-4615-ad2b-b8c1229845ac",
  "userId": "32c0a5db-05ec-78ea-51ab-3f06b329397e"
}

Sample response

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

Definitions

Name Description
CommunicationError

The Communication Services error.

CommunicationErrorResponse

The Communication Services error.

CommunicationIdentityAccessToken

An access token.

TeamsUserExchangeTokenRequest

CommunicationError

The Communication Services error.

Name Type Description
code

string

The error code.

details

CommunicationError[]

Further details about specific errors that led to this error.

innererror

CommunicationError

The inner error if any.

message

string

The error message.

target

string

The error target.

CommunicationErrorResponse

The Communication Services error.

Name Type Description
error

CommunicationError

The Communication Services error.

CommunicationIdentityAccessToken

An access token.

Name Type Description
expiresOn

string

The expiry time of the token.

token

string

The access token issued for the identity.

TeamsUserExchangeTokenRequest

Name Type Description
appId

string

Client ID of an Azure AD application to be verified against the appid claim in the Azure AD access token.

token

string

Azure AD access token of a Teams User to acquire a new Communication Identity access token.

userId

string

Object ID of an Azure AD user (Teams User) to be verified against the oid claim in the Azure AD access token.