Skip to content

feat: add AWS Bedrock API Key (Bearer Token) authentication support - #6685

Open
xowjd258 wants to merge 2 commits into
FlowiseAI:mainfrom
xowjd258:feature/aws-bedrock-bearer-token
Open

feat: add AWS Bedrock API Key (Bearer Token) authentication support#6685
xowjd258 wants to merge 2 commits into
FlowiseAI:mainfrom
xowjd258:feature/aws-bedrock-bearer-token

Conversation

@xowjd258

Copy link
Copy Markdown

Summary

Add support for AWS Bedrock API Key (Bearer Token) authentication, enabling users to authenticate without IAM credentials.

Problem

The AWS Bedrock Chat Model node currently only supports IAM-based authentication (access key + secret key). AWS Bedrock now supports API Key (Bearer Token) authentication as an alternative, but Flowise doesn't expose this option.

Changes

New file

  • packages/components/credentials/AWSBedrockApiKey.credential.ts — New credential type awsBedrockApiKey with a single password field for the Bearer Token

Modified file

  • packages/components/nodes/chatmodels/AWSBedrock/AWSChatBedrock.ts
    • Added awsBedrockApiKey to credential dropdown options (alongside existing awsApi)
    • Added node-level Bedrock API Key (Bearer Token) input field for quick testing
    • In init(), when a Bearer Token is provided (via credential or direct input):
      • Creates a custom BedrockRuntimeClient with the token injected via middleware as Authorization: Bearer <token>
      • The custom client is passed via ChatBedrockConverseInput.client
    • Backward compatible: existing IAM credential flow unchanged

How it works

User provides Bearer Token (credential or node input)
    ↓
BedrockRuntimeClient created with middleware
    injecting Authorization: Bearer <token> header
    ↓
Custom client passed to ChatBedrockConverse
    ↓
Bearer token authentication on all Converse/ConverseStream calls

Usage

  1. Create a credential → "AWS Bedrock API Key" → enter your API Key
  2. Select it in the Bedrock node's credential dropdown
  3. IAM fields can be left empty — Bearer Token takes precedence

Alternatively, enter the token directly in the node's "Bedrock API Key (Bearer Token)" field under Additional Parameters.

Testing

  • All 140 existing Bedrock tests pass (no regression)
  • pnpm --filter flowise-components build succeeds
  • ESLint + Prettier hooks pass

Add support for AWS Bedrock API Key (Bearer Token) authentication,
enabling users to authenticate without IAM credentials.

Changes:
- New credential type: 'AWS Bedrock API Key' (awsBedrockApiKey)
- Bedrock Chat Model node now supports both IAM and API Key credentials
- Bearer token injected via BedrockRuntimeClient middleware
- Backward compatible: existing IAM flows unchanged

Auth flow:
1. Create 'AWS Bedrock API Key' credential with your bearer token
2. Select it in the Bedrock node's credential dropdown
3. Token is injected as 'Authorization: Bearer <token>' header

Also supports direct input via node-level 'Bedrock API Key' field
for quick testing, and the AWS_BEARER_TOKEN_BEDROCK environment
variable as an additional fallback.
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant