export function buildMSTeamsAuthUrl(params: {
tenantId: string;
clientId: string;
challenge: string; /** Opaque CSRF state token — must NOT be the PKCE verifier. */
state: string;
scopes?: readonly string[];
}): string { const scopes = params.scopes ?? MSTEAMS_DEFAULT_DELEGATED_SCOPES; const endpoint = buildMSTeamsAuthEndpoint(params.tenantId); const query = new URLSearchParams({
client_id: params.clientId,
response_type: "code",
redirect_uri: MSTEAMS_OAUTH_REDIRECT_URI,
scope: scopes.join(" "),
code_challenge: params.challenge,
code_challenge_method: "S256",
state: params.state,
prompt: "consent",
}); return `${endpoint}?${query.toString()}`;
}
export function parseCallbackInput(
input: string, // Kept in the signature for API symmetry with the caller's CSRF verify step. // The caller compares the parsed `state` against the expected value.
_expectedState: string,
): { code: string; state: string } | { error: string } { return parseOAuthCallbackInput(input, {
missingState: "Missing 'state' parameter in URL. Paste the full redirect URL.",
invalidInput: "Paste the full redirect URL (including code and state parameters), not just the authorization code.",
});
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.