Registry /
auth-security / opencode-antigravity-auth
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslnode 18–226 runs
build_error
glibcnode 18–226 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
default
✓ import antigravityAuth from 'opencode-antigravity-auth'
✗ const antigravityAuth = require('opencode-antigravity-auth')
This package is ESM-only since v1.0. CommonJS require will fail.
configureAuth
✓ import { configureAuth } from 'opencode-antigravity-auth'
✗ import { configureAuth } from 'opencode-antigravity-auth/configure'
configureAuth is a named export from the main module. There is no subpath export.
AuthProvider
✓ import type { AuthProvider } from 'opencode-antigravity-auth'
AuthProvider is a type export. Use 'import type' to avoid bundling issues in TypeScript.
createMiddleware
✓ import { createMiddleware } from 'opencode-antigravity-auth'
✗ import { createMiddleware } from 'opencode-antigravity-auth/middleware'
createMiddleware is re-exported from the main entry. No separate middleware module.
Shows standard OAuth flow: initialize plugin, generate auth URL, exchange code, and make authenticated API request.
import antigravityAuth from 'opencode-antigravity-auth';
// Initialize the auth plugin with required configuration
const auth = antigravityAuth({
clientId: process.env.GOOGLE_CLIENT_ID ?? '',
clientSecret: process.env.GOOGLE_CLIENT_SECRET ?? '',
redirectUri: 'http://localhost:3000/callback',
scopes: ['openid', 'email', 'profile'],
});
// Generate the authorization URL
const authUrl = auth.generateAuthUrl();
console.log('Open the following URL in your browser:', authUrl);
// After redirect, exchange the code for tokens
const tokens = await auth.exchangeCode('authorization-code-from-query');
console.log('Access token:', tokens.accessToken);
// Use the tokens to make authenticated requests
const response = await auth.request('/api/gemini', {
method: 'POST',
body: JSON.stringify({ prompt: 'Hello' }),
});
console.log('API response:', await response.json());
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module /path/to/node_modules/opencode-antigravity-auth/index.mjs not supported.
Trying to require() an ESM-only package in a CommonJS project.
fixUse dynamic import: const antigravityAuth = await import('opencode-antigravity-auth'); TypeError: auth.generateAuthUrl is not a function
configureAuth was called without clientId or redirectUri, causing generateAuthUrl to not be attached.
fixEnsure the config object includes both clientId and redirectUri.
Error: Cannot find module 'opencode-antigravity-auth'
The package is not installed or is not in node_modules.
fixRun npm install opencode-antigravity-auth
TypeError: Cannot destructure property 'accessToken' of 'tokens' as it is undefined.
exchangeCode was called without a valid authorization code, or the code expired.
fixVerify the authorization code is fresh and passed correctly.
Audit
Dependencies
typescriptoptionalpeer dependency >=5 for type definitions