slackAccessResultLogFields (models/slackOAuthResultLog.ts)

trigger.dev · apps/webapp/app/models/slackOAuthResultLog.ts · typescript · Apache-2.0
auth, tag:embed-classified

Extracts non-secret fields from a Slack OAuth access response for logging.

// Source: https://github.com/triggerdotdev/trigger.dev | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
// Non-secret fields for logging a Slack `oauth.v2.access` response, which
// otherwise carries bot/user/refresh tokens. Dependency-free so it's
// unit-tested directly.
export type SlackAccessResultLike = {
  team?: { id?: string } | null;
  scope?: string;
  authed_user?: { access_token?: string } | null;
  refresh_token?: string;
};

export function slackAccessResultLogFields(result: SlackAccessResultLike) {
  return {
    teamId: result.team?.id,
    scope: result.scope,
    hasUserToken: !!result.authed_user?.access_token,
    hasRefreshToken: !!result.refresh_token,
  };
}

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key