qmetrics.net

OAuth2 for Apps Script

OAuth2 client library for Google Apps Script projects

OAuth2 for Apps Script screenshot

This library creates and refreshes OAuth2 tokens inside Apps Script, routing user authorization through the platform usercallback endpoint.

Overview

OAuth2 for Apps Script is a library published for Google Apps Script projects that need to authorize against external OAuth2 providers. It wraps creation of authorization URLs, callback handling, access-token retrieval, refresh, and logout reset in a service object you configure per provider.

Redirects use Apps Script StateTokenBuilder and the standard usercallback URL format tied to your script ID, which you register as the redirect URI with the provider. Many Google APIs may be reachable through built-in or advanced Apps Script services without this library, using ScriptApp.getOAuthToken instead.

Typical usage builds a private OAuth2Service with endpoints and client credentials, sends the user to getAuthorizationUrl, handles handleCallback in a web callback, then attaches the bearer token to UrlFetchApp requests. Token persistence uses PropertiesService or CacheService with optional LockService to avoid refresh races in add-ons.

Advanced configuration covers token payload formats, extra headers, non-POST token endpoints, custom payload handlers, service-account JWT flows including domain-wide delegation, and alternate grant types such as client credentials.

Key features

  • OAuth2 authorization URL generation
  • Apps Script usercallback redirect handling
  • Access token refresh and reset
  • Properties and cache backed token storage
  • Locking around concurrent token refresh
  • Service account JWT authorization flow
  • Support for custom grant types and headers
  • Published Apps Script library distribution

Use cases

  • Third-party API access from Workspace automations
  • Add-on OAuth for non-Google providers
  • Service account calls with domain-wide delegation
  • Persisted tokens for scheduled script triggers

Tags

Similar software

Auth.js

Web authentication libraries for JavaScript frameworks

Auth.js (NextAuth) adds sign-in, sessions, and OAuth to modern JavaScript apps. Packages target Next.js, SvelteKit, Express, Qwik, and other runtimes.

★ 28.4k⟳ 4 months agoISC

Devise

Modular authentication engine for Ruby on Rails

Devise adds sign-in, registration, and related account flows to Rails apps through a Warden-backed engine. Teams enable only the authentication modules they need for each user model.

★ 24.3k⟳ 1 month agoMIT

jsonwebtoken

Node.js library for signing and verifying JSON Web Tokens

jsonwebtoken implements JWT creation and verification for Node.js using HMAC, RSA, ECDSA, and related algorithms. It exposes sign, verify, and decode helpers built on node-jws.

★ 18.2k⟳ 5 months agoMIT

JustAuth

Java library for third-party OAuth login

JustAuth is a Java component that wires social and enterprise OAuth providers into applications without vendor-specific SDKs. It exposes a small API with builder-style configuration.

★ 17.6k⟳ 1 year agoMIT
Identity & Access Management (IAM)No commits in 18+ monthsDesktop/CLI app

laravel-permission

Database-backed roles and permissions for Laravel applications

Laravel Permission stores roles and permissions in the database and wires them to users, guards, and Laravel’s authorization gate.

★ 13k⟳ 2 days agoMIT

CASL

Isomorphic TypeScript authorization for apps and APIs

CASL limits which resources a user may access using declarative rules shared across frontend, backend, and database layers.

★ 7.1k⟳ 4 days agoMIT