Skip to content

Latest commit

 

History

History

samples

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Google Cloud Platform logo

Open in Cloud Shell

This is Google's officially supported node.js client library for using OAuth 2.0 authorization and authentication with Google APIs.

Table of Contents

Before you begin

Before running the samples, make sure you've followed the steps outlined in Using the client library.

cd samples

npm install

cd ..

Samples

Adc

View the source code.

Open in Cloud Shell

Usage:

node samples/adc.js


Authenticate API Key

View the source code.

Open in Cloud Shell

Usage:

node samples/authenticateAPIKey.js


Authenticate Explicit

View the source code.

Open in Cloud Shell

Usage:

node samples/authenticateExplicit.js


Authenticate Implicit With Adc

View the source code.

Open in Cloud Shell

Usage:

node samples/authenticateImplicitWithAdc.js


Compute

View the source code.

Open in Cloud Shell

Usage:

node samples/compute.js


Credentials

View the source code.

Open in Cloud Shell

Usage:

node samples/credentials.js


Downscopedclient

View the source code.

Open in Cloud Shell

Usage:

node samples/downscopedclient.js


Headers

View the source code.

Open in Cloud Shell

Usage:

node samples/headers.js


Id Token From Impersonated Credentials

View the source code.

Open in Cloud Shell

Usage:

node samples/idTokenFromImpersonatedCredentials.js


Id Token From Metadata Server

View the source code.

Open in Cloud Shell

Usage:

node samples/idTokenFromMetadataServer.js


Id Token From Service Account

View the source code.

Open in Cloud Shell

Usage:

node samples/idTokenFromServiceAccount.js


ID Tokens for Identity-Aware Proxy (IAP)

Requests an IAP-protected resource with an ID Token.

View the source code.

Open in Cloud Shell

Usage:

node idtokens-iap.js <url> <target-audience>


ID Tokens for Serverless

Requests a Cloud Run or Cloud Functions URL with an ID Token.

View the source code.

Open in Cloud Shell

Usage:

node idtokens-serverless.js <url> [<target-audience>]


Jwt

View the source code.

Open in Cloud Shell

Usage:

node samples/jwt.js


Keepalive

View the source code.

Open in Cloud Shell

Usage:

node samples/keepalive.js


Keyfile

View the source code.

Open in Cloud Shell

Usage:

node samples/keyfile.js


Oauth2-code Verifier

View the source code.

Open in Cloud Shell

Usage:

node samples/oauth2-codeVerifier.js


Oauth2

View the source code.

Open in Cloud Shell

Usage:

node samples/oauth2.js


Sign Blob

View the source code.

Open in Cloud Shell

Usage:

node samples/signBlob.js


Sign Blob Impersonated

View the source code.

Open in Cloud Shell

Usage:

node samples/signBlobImpersonated.js


Verify Google Id Token

View the source code.

Open in Cloud Shell

Usage:

node samples/verifyGoogleIdToken.js


Verifying ID Tokens from Identity-Aware Proxy (IAP)

Verifying the signed token from the header of an IAP-protected resource.

View the source code.

Open in Cloud Shell

Usage:

node verifyIdToken-iap.js <iap-jwt> [<project-number>] [<project-id>] [<backend-service-id>]


Verify Id Token

View the source code.

Open in Cloud Shell

Usage:

node samples/verifyIdToken.js