Share via


TeamsUserCredential class

Warning

This API is now deprecated.

This package will be deprecated by 2026-07. Please use Microsoft 365 Agents SDK instead.

Represent Teams current user's identity, and it is used within Teams client applications.

Remarks

Can only be used within Teams.

Constructors

TeamsUserCredential(TeamsUserCredentialAuthConfig)

Constructor of TeamsUserCredential.

Methods

getToken(string | string[], GetTokenOptions)

Get access token from credential.

getUserInfo(string[])

Get basic user info from SSO token

login(string | string[], string[])

Popup login page to get user's access token with specific scopes.

Constructor Details

TeamsUserCredential(TeamsUserCredentialAuthConfig)

Warning

This API is now deprecated.

This package will be deprecated by 2026-07. Please use Microsoft 365 Agents SDK instead.

Constructor of TeamsUserCredential.

new TeamsUserCredential(authConfig: TeamsUserCredentialAuthConfig)

Parameters

Remarks

Can only be used within Teams.

Method Details

getToken(string | string[], GetTokenOptions)

Warning

This API is now deprecated.

This package will be deprecated by 2026-07. Please use Microsoft 365 Agents SDK instead.

Get access token from credential.

function getToken(scopes: string | string[], options?: GetTokenOptions): Promise<null | AccessToken>

Parameters

scopes

string | string[]

options
GetTokenOptions

Returns

Promise<null | AccessToken>

Remarks

Can only be used within Teams.

getUserInfo(string[])

Warning

This API is now deprecated.

This package will be deprecated by 2026-07. Please use Microsoft 365 Agents SDK instead.

Get basic user info from SSO token

function getUserInfo(resources?: string[]): Promise<UserInfo>

Parameters

resources

string[]

The optional list of resources for full trust Teams apps.

Returns

Promise<UserInfo>

Remarks

Can only be used within Teams.

login(string | string[], string[])

Warning

This API is now deprecated.

This package will be deprecated by 2026-07. Please use Microsoft 365 Agents SDK instead.

Popup login page to get user's access token with specific scopes.

function login(scopes: string | string[], resources?: string[]): Promise<void>

Parameters

scopes

string | string[]

resources

string[]

The optional list of resources for full trust Teams apps.

Returns

Promise<void>

Remarks

Can only be used within Teams.