@locksyk/msteams-client
v0.1.0
Published
Browser half of locksyk/msteams-bundle's Teams embedding: launch detection via the manifest's ?inTeams=1 flag, and the silent tab-SSO token exchange (lazy @microsoft/teams-js).
Maintainers
Readme
@locksyk/msteams-client
The browser half of
locksyk/msteams-bundle's
Teams embedding. Lives in the bundle's repository (frontend/) so both
halves version and evolve together.
import { detectTeamsLaunch, isInTeams, teamsAuthToken } from '@locksyk/msteams-client'
// Before the router mounts (it strips the query string): persist the
// manifest's ?inTeams=1 launch flag for the session.
detectTeamsLaunch()
if (isInTeams()) {
// Silent tab SSO: swap the host token for your app session, e.g.
// against the bundle-verified POST /api/auth/teams.
const token = await teamsAuthToken()
}@microsoft/teams-js is an optional peer, imported lazily - browsers
outside Teams never load it. isInTeams() requires both the persisted
flag and an actual frame, so a bookmarked ?inTeams=1 URL in a plain
tab never attempts Teams SSO.
Exports point at TypeScript source while the package is consumed via
file: links; npm run build produces dist/ (JS + .d.ts) and the
exports flip to it at first npm publication.
License
GPL-2.0-only.
