In-App UI
React
Hooks
useMsTeamsAuth
useMsTeamsAuth
The useMsTeamsAuth hook is used to manage Microsoft Teams authentication for connecting user accounts to Teams workspaces. This hook must be used within a KnockMsTeamsProvider.
Parameters
#graphApiClientIdstringRequired
The Microsoft Graph API client ID for your application.
redirectUrlstring
Optional URL to redirect to after authentication completes.
Returns
#Returns an object with the following properties:
buildMsTeamsAuthUrl() => string
Function that builds the Microsoft Teams OAuth authorization URL.
disconnectFromMsTeams() => Promise<void>
Function to revoke Microsoft Teams access for the current user.
Example
#Basic usage
#The following example demonstrates how to use the useMsTeamsAuth hook to manage Microsoft Teams authentication.