TeamsUserCredential Class

Definition

Represent Teams current user's identity, and it is used within Teams tab application.

public class TeamsUserCredential : Azure.Core.TokenCredential, IAsyncDisposable
type TeamsUserCredential = class
    inherit TokenCredential
    interface IAsyncDisposable
Public Class TeamsUserCredential
Inherits TokenCredential
Implements IAsyncDisposable
Inheritance
TeamsUserCredential
Implements

Remarks

Can only be used within Blazor server for security reason.

Constructors

TeamsUserCredential(IOptions<AuthenticationOptions>, IJSRuntime, ILogger<TeamsUserCredential>, IIdentityClientAdapter)

Constructor of TeamsUserCredential. Developer need to configure TeamsFx service before using this class.

Methods

DisposeAsync()

Dispose.

GetToken(TokenRequestContext, CancellationToken)

Sync version is not supported now. Please use GetTokenAsync instead.

GetTokenAsync(TokenRequestContext, CancellationToken)

Gets an Azure.Core.AccessToken for the specified set of scopes.

GetUserInfoAsync()

Get basic information of current Teams user. For example:

var user = await teamsUserCredential.GetUserInfoAsync();
LoginAsync(String)

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

LoginAsync(String[])

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

Applies to