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

@tenonhq/sincronia-google-auth

v0.0.8

Published

Google OAuth2 auth client for Sincronia Google integrations

Downloads

884

Readme

@tenonhq/sincronia-google-auth

Google OAuth2 authentication for Sincronia Google integrations. Shared auth layer used by @tenonhq/sincronia-gmail and @tenonhq/sincronia-google-calendar.

Setup

1. Create a Google Cloud Project

  1. Go to Google Cloud Console
  2. Click New Project and name it (e.g., "Tenon CTO Automation")
  3. Select the project

2. Enable APIs

  1. Go to APIs & Services > Library
  2. Search for and enable:
    • Gmail API
    • Google Calendar API

3. Create OAuth Credentials

  1. Go to APIs & Services > Credentials
  2. Click Create Credentials > OAuth client ID
  3. If prompted, configure the OAuth consent screen first:
    • User type: Internal (Google Workspace) or External
    • App name: "Tenon CTO Automation"
    • Scopes: gmail.modify, calendar
  4. Application type: Desktop app (or Web application)
  5. If using Web application, add http://localhost:3000/callback as an Authorized redirect URI
  6. Download or copy the Client ID and Client Secret

4. Get a Refresh Token

# Set your credentials
export GOOGLE_CLIENT_ID="your-client-id"
export GOOGLE_CLIENT_SECRET="your-client-secret"

# Run the setup script
cd packages/google-auth
npm run setup

This opens your browser for Google authorization. After granting access, the refresh token is printed to the terminal.

5. Add to .env

GOOGLE_CLIENT_ID=your-client-id
GOOGLE_CLIENT_SECRET=your-client-secret
GOOGLE_REFRESH_TOKEN=your-refresh-token

Usage

import { createGoogleAuth, configFromEnv } from "@tenonhq/sincronia-google-auth";

// Load config from environment variables
var config = configFromEnv();

// Create authenticated client
var { auth } = createGoogleAuth({ config: config });

// Pass auth to Gmail or Calendar packages

Token Expiration

Google refresh tokens expire after 7 days for apps in "Testing" status.

To get long-lived tokens:

  • Google Workspace accounts: Set the app consent screen to Internal
  • Personal accounts: Set the app to In production (requires verification for sensitive scopes, or keep under 100 users for unverified apps)

If your token expires, run npm run setup again to get a new one.

API

createGoogleAuth({ config })

Creates an OAuth2Client with a refresh token. Token refresh is handled automatically.

configFromEnv()

Reads GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET, and GOOGLE_REFRESH_TOKEN from process.env.

handleAuthError(error, context)

Standardized error handler for Google API errors. Maps HTTP status codes (401, 403, 429) to actionable error messages.