INNER CODE UNIT · TypeScript

view

jonwiggins/optio · apps/api/src/services/oauth/index.ts:32

    const view = views.find((v) => v.provider === name);
    if (view?.enabled) out.push({ name, displayName: view.displayName });
  }
  return out;
}

/** Returns providers that have their client ID configured by the environment alone. */
export function getEnabledProviders(): EnabledProvider[] {
  const result: EnabledProvider[] = [];
  if (process.env.GITHUB_OAUTH_CLIENT_ID || process.env.GITHUB_APP_CLIENT_ID) {
    result.push({ name: "github", displayName: "GitHub" });
  }
  if (process.env.GOOGLE_OAUTH_CLIENT_ID) {
    result.push({ name: "google", displayName: "Google" });
  }
  if (process.env.GITLAB_OAUTH_CLIENT_ID) {
    result.push({ name: "gitlab", displayName: "GitLab" });
  }

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…