Skip to content

Conversation

@vverman
Copy link

@vverman vverman commented Nov 18, 2025

Adding documentation for Custom Credential Suppliers.

Custom Credential Suppliers enable developers to securely integrate third-party authentication directly into the Google Cloud SDKs. Custom Credential Suppliers are primarily used to handle authentication in non-standard cloud environments.

The design and scopes for this are documented under this design doc

Note: Before submitting a pull request, please open an issue for discussion if you are not associated with Google.

Checklist

  • I have followed guidelines from CONTRIBUTING.MD and Samples Style Guide
  • Tests pass: npm test (see Testing)
  • Lint pass: npm run lint (see Style)
  • Required CI tests pass (see CI testing)
  • These samples need a new API enabled in testing projects to pass (let us know which ones)
  • These samples need a new/updated env vars in testing projects set to pass (let us know which ones)
  • This pull request is from a branch created directly off of GoogleCloudPlatform/nodejs-docs-samples. Not a fork.
  • This sample adds a new sample directory, and I updated the CODEOWNERS file with the codeowners for this sample
  • This sample adds a new sample directory, and I created GitHub Actions workflow for this sample
  • This sample adds a new Product API, and I updated the Blunderbuss issue/PR auto-assigner with the codeowners for this sample
  • Please merge this PR for me once it is approved

Note: Any check with (dev), (experimental), or (legacy) can be ignored and should not block your PR from merging (see CI testing).

These tests will safely skip if the env variables aren't provided.

For the auth/system-test/customCredentialSupplierAws.test.js, we need: AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION, GCP_WORKLOAD_AUDIENCE, GCS_BUCKET_NAME. Please refer to the ‎auth/README.md under custom credential suppliers for AWS.

For the auth/system-test/customCredentialSupplierOkta.test.js, we need: OKTA_DOMAIN, OKTA_CLIENT_ID, OKTA_CLIENT_SECRET, GCP_WORKLOAD_AUDIENCE, GCS_BUCKET_NAME. Please refer to the auth/README.md under custom credential suppliers for Okta.

@vverman vverman requested review from a team as code owners November 18, 2025 08:05
@snippet-bot
Copy link

snippet-bot bot commented Nov 18, 2025

Here is the summary of changes.

You are about to add 3 region tags.
You are about to delete 1 region tag.

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment

@product-auto-label product-auto-label bot added samples Issues that are directly related to samples. api: aiplatform Issues related to the AI Platform API. api: auth api: cloudscheduler Issues related to the Cloud Scheduler API. api: cloudsql Issues related to the Cloud SQL for MySQL API. api: recaptchaenterprise Issues related to the reCAPTCHA API. api: securitycenter Issues related to the Security Command Center API. api: translate Issues related to the Cloud Translation API. asset: pattern DEE Asset tagging - Pattern. labels Nov 18, 2025
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @vverman, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the authentication samples by introducing support for custom credential suppliers. It provides developers with practical examples and detailed documentation on how to integrate third-party authentication providers like AWS and Okta with Google Cloud SDKs, particularly useful for non-standard cloud environments and Workload Identity Federation. This broadens the scope of authentication methods available within the samples.

Highlights

  • New Custom Credential Supplier Documentation: Comprehensive documentation has been added for integrating custom credential suppliers, specifically for AWS and Okta, into Google Cloud SDKs. This includes setup instructions and environment variable requirements.
  • AWS Credential Supplier Sample: A new sample (auth/customCredentialSupplierAws.js) demonstrates how to use the AWS SDK to bridge AWS credentials (from sources like EKS IRSA, ECS, or local profiles) to Google Cloud Workload Identity.
  • Okta Credential Supplier Sample: A new sample (auth/customCredentialSupplierOkta.js) illustrates fetching OIDC tokens from Okta via the Client Credentials flow and exchanging them for Google Cloud credentials using Workload Identity Federation.
  • System Tests for Custom Suppliers: Dedicated system tests (auth/system-test/customCredentialSupplierAws.test.js and auth/system-test/customCredentialSupplierOkta.test.js) have been added to verify the functionality of both AWS and Okta custom credential suppliers.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@vverman vverman changed the title Feat/documenting custom credential supplier feat: Documenting custom credential suppliers Nov 18, 2025
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces valuable documentation and samples for using Custom Credential Suppliers with AWS and Okta. The new samples are well-structured and the documentation is clear. I've identified a critical issue in package.json with a dependency version that will prevent installation. Additionally, I've suggested improvements for one of the new samples to enhance clarity and robustness, and pointed out a significant readability issue in a test file caused by unconventional syntax. The other changes are minor and related to code formatting.

"dependencies": {
"@aws-sdk/client-sts": "^3.58.0",
"@aws-sdk/credential-providers": "^3.0.0",
"dotenv": "^17.0.0",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The specified version ^17.0.0 for the dotenv package does not exist, which will cause npm install to fail. The latest version is in the 16.x.x range. Please correct the version to a valid one, such as ^16.4.5.

Suggested change
"dotenv": "^17.0.0",
"dotenv": "^16.4.5",

async fetchOktaAccessToken() {
const params = new URLSearchParams();
params.append('grant_type', 'client_credentials');
params.append('scope', 'gcp.test.read');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The scope gcp.test.read is hardcoded. While this is fine for a demonstration, it might not be obvious to users that this needs to match their Okta application configuration. Adding a comment would improve the sample's clarity and help prevent potential integration issues for users adapting this code.

Suggested change
params.append('scope', 'gcp.test.read');
// The scope 'gcp.test.read' is an example. You may need to update it
// based on your Okta application's configuration.
params.append('scope', 'gcp.test.read');

}
} catch (error) {
throw new Error(
`Failed to authenticate with Okta: ${error.response?.data || error.message}`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

When an error occurs during authentication with Okta, if error.response.data is an object, it will be stringified as [object Object], which is not helpful for debugging. It's better to serialize it as a JSON string to provide a more meaningful error message.

Suggested change
`Failed to authenticate with Okta: ${error.response?.data || error.message}`
`Failed to authenticate with Okta: ${error.response?.data ? JSON.stringify(error.response.data) : error.message}`

@jackwotherspoon jackwotherspoon removed their assignment Nov 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: aiplatform Issues related to the AI Platform API. api: auth api: cloudscheduler Issues related to the Cloud Scheduler API. api: cloudsql Issues related to the Cloud SQL for MySQL API. api: recaptchaenterprise Issues related to the reCAPTCHA API. api: securitycenter Issues related to the Security Command Center API. api: translate Issues related to the Cloud Translation API. asset: pattern DEE Asset tagging - Pattern. samples Issues that are directly related to samples.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants