npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@karmadev.studio/google-login-preflight

v0.1.1

Published

Dependency-free CLI for diagnosing Google login configuration issues on the web

Readme

Google Login Preflight

Google sign-in can fail when a page’s headers block the Google Identity Services (GIS) SDK or interfere with a popup. Google Login Preflight checks those headers and the initial HTML for common configuration issues. It’s a zero-dependency CLI that works with any web framework.

Quick start

With Node.js 20 or later, run this from your application’s directory. Replace the URL with your deployed login page or local development server.

npx @karmadev.studio/google-login-preflight http://127.0.0.1:3000/login

Add --json for a versioned, machine-readable report or --strict to make warnings fail CI. Exit codes are 0 for no blocking findings, 1 for errors or warnings in strict mode, and 2 for invalid input or a failed request.

To install globally, run npm install --global @karmadev.studio/google-login-preflight, then use google-login-preflight <url>. From this repository’s checkout, use node bin/google-login-preflight.js <url>.

Example output (excerpt)

A local test page with the GIS SDK tag and Cross-Origin-Opener-Policy: same-origin produced these lines:

[PASS] GIS SDK script is present in the server-delivered HTML.
[WARN] COOP same-origin can break non-FedCM Google login / authorization popups.
  → If using popups that need cross-window communication, review same-origin-allow-popups. FedCM sign-in may not need this change.

What the CLI checks

| Check | What the report tells you | | --- | --- | | HTTPS or loopback URL | Whether the URL uses HTTPS or a recognized local development origin | | GIS SDK tag | Whether the initial HTML contains a direct SDK tag or apparent duplicates | | Deprecated Google Sign-In | Whether the HTML contains possible gapi.auth2 or platform.js references | | Enforcing response CSP | Whether common policy rules appear to restrict Google’s recommended GIS sources. Endpoint-specific allowlists may work for some flows. | | COOP | Whether same-origin could interfere with non-FedCM popups that need cross-window communication | | Permissions-Policy | Whether the response explicitly disables identity-credentials-get |

The CLI inspects HTTP response headers and server-delivered HTML. It follows redirects, including to another host, uses a 10-second timeout, and stops reading successful responses above 2 MB. It fetches without credentials, cookies, or tokens and omits query strings from the report. Use a publicly reachable or local page that does not require authentication.

What to verify manually

  • In the browser, check that the SDK loads, GIS initializes as intended, and the relevant popup or FedCM flow works with the browser’s settings and iframe permissions. Dynamic loading can explain an informational missing-tag finding. Inert markup such as comments or templates can count toward the tag check. A static scan cannot reliably detect repeated google.accounts.id.initialize() calls.
  • For CSP, confirm the actual browser requests when policies use nonces, hashes, strict-dynamic, encoded paths, or HTML meta tags.
  • In Google Cloud Console, verify the authorized JavaScript origins and any redirect URIs against your deployed configuration.
  • On the server, verify ID tokens before making security-critical decisions. Browser-side decoding alone does not verify a token.

A clean report covers the static checks above. Sign-in success and application security require browser and server validation. This project is independent of Google.

Programmatic use

import { inspectGoogleIdentityPage, scanGoogleIdentityUrl } from '@karmadev.studio/google-login-preflight';

const report = inspectGoogleIdentityPage({
  url: 'https://example.com/login',
  headers: { 'cross-origin-opener-policy': 'same-origin' },
  html: '<script src="https://accounts.google.com/gsi/client" async></script>',
});
console.log(report.checks);

// Or fetch a target page:
// const liveReport = await scanGoogleIdentityUrl('http://localhost:3000/login');

Official references

Contributing

This is a small proof of concept. Contributions should prioritize reliable, non-invasive diagnostics with actionable output, test fixtures, and an explicit distinction between confirmed and possible problems. No analytics or telemetry.

npm test
npm pack --dry-run
node --test test/cli.test.js

The CLI smoke test starts a loopback HTTP server with a GIS-recommended CSP fixture and a restrictive CSP/COOP fixture. It checks normal, strict, JSON, and strict JSON modes.

MIT licensed.