UNPKG

@microsoft/teamsfx-cli

Version:

TeamsFx CLI a text-based command line interface that can help scaffold, validate, and deploy applications for Microsoft Teams from the terminal or a CI/CD process.

24 lines (20 loc) 950 B
// This file is auto generated by Teams Toolkit to provide you instructions and reference code to implement single sign on. // This file will initialize TeamsFx SDK and show `GetUserProfile` component after initialization. import { useTeamsFx } from "@microsoft/teamsfx-react"; import { GetUserProfile } from "./GetUserProfile"; export function InitTeamsFx() { // For usage of useTeamsFx(), please refer to: https://www.npmjs.com/package/@microsoft/teamsfx-react#useTeamsfx. // You need to wait until `loading == false` to use TeamsFx SDK. const { loading, error, teamsfx } = useTeamsFx({ initiateLoginEndpoint: process.env.REACT_APP_START_LOGIN_PAGE_URL, clientId: process.env.REACT_APP_CLIENT_ID, }); return ( <div> {!loading && error && ( <div className="error">Failed init TeamsFx. Please try again later.</div> )} {!loading && teamsfx && <GetUserProfile teamsfx={teamsfx} />} </div> ); }