Scan your whole stack
From OX Research Newsroom
Are you using google-workspace-id-token-verifier?
Find out what’s in your code.
Scan your apps free in minutes (opens in a new tab)Latest version: v0.1.2
google-workspace-id-token-verifier was last scanned on 28 Nov 2026 at version 0.1.2. Risk score 0 of 100. No malicious behavior was detected.
| Version | Published | Status |
|---|---|---|
| 0.1.2 LATEST | 28 Nov 2026 | No rules fired |
| 0.1.1 | 28 Nov 2026 | No rules fired |
| 0.0.0-stage | 28 Nov 2026 | Not shown |
Findings for v0.1.2. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.
The score describes 0.1.2; other versions have their own rules, not their own score.
The publisher’s own README, as collected from the registry.
Verifies a Google ID token and accepts only email-verified users in the configured Google Workspace domains.
A failure to download Google's verification certificates is reported separately from a rejected token.
hd) is one of the configured Workspace domainsemail_verified to be true, unless that check is turned offGoogleWorkspaceIdTokenVerifier.verify asks google-auth-library verifyIdToken to check the signature, aud, exp, and iss. This package does not check those claims itself.
It then accepts the token only when all of the following hold:
hd equals one of workspaceDomains. A token with no hd is a personal Google account and is rejected.email_verified is true, unless requireEmailVerified is false.sub and email are non-empty.The email address domain is not an allow list. An address at a Workspace domain can be created outside that Workspace, so the hosted-domain claim is the check.
The accepted result includes payload, the verified token payload, for further checks by the caller.
verifyIdToken uses the same Error type when the token is bad and when Google's verification certificates cannot be downloaded. This package splits those outcomes:
GoogleWorkspaceIdTokenVerifierInvalidIdTokenError means the token was rejected. Respond with 401. The message does not include the token. reason is there for logs.GoogleWorkspaceIdTokenVerifierCertificateFetchError means the certificates could not be downloaded. Respond with 5xx. The original error is cause. A 401 would make a Google outage look like the caller presented a bad token.Check the specific error class before the base GoogleWorkspaceIdTokenVerifierError.
npm install google-workspace-id-token-verifier
yarn add google-workspace-id-token-verifier
pnpm add google-workspace-id-token-verifier
Create one verifier for each client ID set and domain set, outside the handler, and reuse it. OAuth2Client caches the certificates on that instance.
import {
GoogleWorkspaceIdTokenVerifier,
GoogleWorkspaceIdTokenVerifierCertificateFetchError,
GoogleWorkspaceIdTokenVerifierInvalidIdTokenError,
} from 'google-workspace-id-token-verifier';
const verifier = new GoogleWorkspaceIdTokenVerifier({
clientIds: ['your-client-id.apps.googleusercontent.com'],
workspaceDomains: ['example.com'],
});
export const handler = async (idToken: string) => {
try {
const identity = await verifier.verify(idToken);
return {
statusCode: 200,
body: JSON.stringify({ sub: identity.sub, email: identity.email }),
};
} catch (error) {
if (error instanceof GoogleWorkspaceIdTokenVerifierInvalidIdTokenError) {
return { statusCode: 401 };
}
if (error instanceof GoogleWorkspaceIdTokenVerifierCertificateFetchError) {
return { statusCode: 500 };
}
throw error;
}
};
Any one client ID and any one hosted domain is enough:
new GoogleWorkspaceIdTokenVerifier({
clientIds: [
'client-a.apps.googleusercontent.com',
'client-b.apps.googleusercontent.com',
],
workspaceDomains: ['example.com', 'other.example'],
});
Skip the verified-email check:
new GoogleWorkspaceIdTokenVerifier({
clientIds: ['your-client-id.apps.googleusercontent.com'],
workspaceDomains: ['example.com'],
requireEmailVerified: false,
});
new GoogleWorkspaceIdTokenVerifier(policy, options?)
| Name | Type | Required | Description |
|---|---|---|---|
clientIds |
readonly string[] |
Yes | OAuth client IDs accepted as aud. Any one match is enough. |
workspaceDomains |
readonly string[] |
Yes | Workspace hosted domains accepted as hd. Any one match is enough. |
requireEmailVerified |
boolean |
No | When omitted, email_verified must be true. Set false to skip that check. |
| Name | Type | Required | Description |
|---|---|---|---|
client |
OAuth2Client |
No | Client from google-auth-library used to verify the token. When omitted, one client is created and reused for this instance. |
This project is licensed under the Apache-2.0 License.
Find threats in your stack.
OX Radar can check high-priority threats, like critical package CVEs, against your context.
Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.
The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).
The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.